fix bug where variables would not properly reset

If I start a new animation without the old one completing, `i` will not have properly reset.