play-co / timestep

GNU General Public License v3.0
16 stars 27 forks source link

Animation > EaseOutBounce and EaseInBounce are indexed incorrectly #26

Closed oodavid closed 9 years ago

oodavid commented 10 years ago

Sincerest apologies, there's a mistake in the pull-request I made that swaps two of the easing functions when deployed. The issue lies on the timestep side of things. Tried to do another pull request but was having a bit of trouble so I'm dumping the changes here, they're minor.

timestep/ui/backend/canvas/animate.js : line 139 I screwed the index order of these - it doesn't match the native-core array order, easeOutBounce and easeInBounce need to be swapped around in order to read:

transitions.easeOutBounce,     // 32
transitions.easeInBounce,      // 33

line 175 should be swapped to read:

exports.easeOutBounce     = 32;
exports.easeInBounce      = 33;

timestep/animate/transitions.js : line 171 "this" should be "exports" I didn't realise these were bound to a different scope

exports.easeInBounce = function (n) {
    return 1 - exports.easeOutBounce(1 - n);
};
exports.easeInOutBounce = function (n) {
    if (n < 0.5) return exports.easeInBounce(n * 2) * .5;
    return exports.easeOutBounce((n * 2) - 1) * .5 + .5;
};

New Example I've knocked together an example Application that demonstrates and tests all the easing options. Have deployed it to my Android device and validated it to be correct (with the changes described above)

https://gist.github.com/oodavid/8835569

collingreen commented 9 years ago

Great example - can I post this as an example project for the animations?

oodavid commented 9 years ago

Of course, that's what it's for!

collingreen commented 9 years ago

The this vs exports errors were fixed a while back in this commit: https://github.com/gameclosure/timestep/commit/17dfc8afa99d62c957efef2e19a54221d6c482cd

I just pushed a new commit that swaps the easeOutBounce and easeInBounce indexes: a835895e957a2e821703596cc21d01ccf3bb13e0

@oodavid I'm tweaking your gist a bit and I'll be adding it to the docs when ready

Closing this issue.