KineticJS icon indicating copy to clipboard operation
KineticJS copied to clipboard

Add mechanism to reset Animation?

Open drwestco opened this issue 13 years ago • 4 comments

The frame.time property indicates the total number of ms the animation has been running, and persists across start() and stop() calls. Since it looks like the animation code passes the actual frame instance held by the animation, I can modify the time property directly, but it would be clearer if Animation had a reset() or similar method to do the same.

drwestco avatar Mar 19 '13 00:03 drwestco

what is the use case here? You need the time to be set back to zero?

ericdrowell avatar Mar 19 '13 01:03 ericdrowell

Yes. In my case, I'm using an animation to pulse the drawing properties of some shapes in response to an event. I figured I'd create the event once, call start() when the event occurs, and call stop() within the frame callback once the desired duration is reached.

drwestco avatar Mar 19 '13 02:03 drwestco

sounds like you should be using Tweens. Here's what you're looking for:

http://www.html5canvastutorials.com/kineticjs/html5-canvas-stop-and-resume-transitions-with-kineticjs/

ericdrowell avatar May 20 '13 04:05 ericdrowell

A reset would be very helpful for me - tweens won't do. I have had to implement my own timer count, which is not a big deal, but it seems like a work-around when a reset would be so much simpler and clearer.

dave-ledsign avatar Feb 14 '14 22:02 dave-ledsign