Fix off-by-one error in both animation.js and tests
Merge pull request #614 from starwed/anim-fix

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