ded / morpheus

A Brilliant Animator
504 stars 57 forks source link

Remove callback on tween.stop unless jump is set #15

Closed danro closed 12 years ago

danro commented 12 years ago

This will change tween.stop to behave more like jQuery.stop... the callback should be removed when stop() is called, unless jump to end is true. (Then the callback would fire right away)

ded commented 12 years ago

what's jQuery's usecase?

danro commented 12 years ago

Here's a quote from their stop() docs:

When .stop() is called on an element, the currently-running animation (if any) is immediately stopped. If, for instance, an element is being hidden with .slideUp() when .stop() is called, the element will now still be displayed, but will be a fraction of its previous height. Callback functions are not called.

and...

If the jumpToEnd property is provided with a value of true, the current animation stops, but the element is immediately given its target values for each CSS property. In our above .slideUp() example, the element would be immediately hidden. The callback function is then immediately called, if provided.

Also, from my previous experience with just about any AS3 tweening engine, when you stop a tween in progress- the callback should be ignored. Sort of like setTimeout and clearTimeout in javascript.

danro commented 12 years ago

If you're hesitant to change the way callbacks work with tween.stop() then perhaps morpheus needs a tween.clear() or something to make sure the callbacks don't fire?

ded commented 12 years ago

nah this is fine.

ded commented 12 years ago

i added tests after the merge and then published to npm

danro commented 12 years ago

sweet, glad I could help. this is a great script.