Fix off-by-one error in both animation.js and tests

I had cleverly managed to introduce an off-by-one error in both the code *and* the unit tests.  

It was obvious when I actually tried to use the animation component with a set of sprites that didn't involve counting up from zero... :)