CreateJS / TweenJS

A simple but powerful tweening / animation library for Javascript. Part of the CreateJS suite of libraries.
http://createjs.com/
MIT License
3.56k stars 967 forks source link

Tween.call is called before the previous action really ended, on oChange event will be called after "call" #85

Closed danielsedlacek closed 7 years ago

danielsedlacek commented 8 years ago

I have

createjs.Tween.get(myShape,{onChange:update)}).to({x : 100}, 2000, createjs.Ease.quartInOut).call(ended);

one more update will be called after ended :(

danielsedlacek commented 8 years ago

A workaround: this is how you identify the last onChange event so that you can use it instead of the call function.

createjs.Tween.get(myShape,{onChange:update)})
    .to({x : 100}, 2000, createjs.Ease.quartInOut).call(ended);

function update(evt) {
    evt.target.duration == evt.target.position
}
gskinner commented 7 years ago

This is expected behavior. The change event is triggered after each tick is resolved, which includes both property updates and action execution. If you want to tie some code into the VERY end of the tween, then use the complete event.

I've updated the documentation to make this more clear.

danielsedlacek commented 7 years ago

I understand. Once you update the documentation there should be no confusion. Thanks.

gskinner commented 7 years ago

The docs for change were updated to: Dispatched whenever the tween's position changes. It occurs after all tweened properties are updated and actions are executed.