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 966 forks source link

Simple method that will tells us if Tween is playing right now or not. #84

Closed danielsedlacek closed 7 years ago

danielsedlacek commented 8 years ago

Surprisingly there is no simple isPlaying() : boolean method. Or am I missing something?

lannymcnie commented 8 years ago

There is currently no API for that. You can determine when a tween has finished by calling a method at the end of the chain:

createjs.Tween({x:0}).to({x:100}).call(handleComplete);

Or you could query the tween's duration and position any time. When they are equal, the tween should be complete.

var complete = (tween.position==tween.duration);

A boolean property is a good idea, so I will leave this issue open to track it!

gskinner commented 7 years ago

I'm looking at changing setPaused into a getter/setter, so you could query paused. Tweens are automatically paused when they reach their end.

Would that meet your needs?

gskinner commented 7 years ago

Added paused. Closing this. Let me know if it doesn't do what you need.

danielsedlacek commented 7 years ago

Perfect. Thanks.