| Page 1 of 1 | [ 5 posts ] |
Josh LizarragaYUI Contributor
|
Hi all,
Is it possible to pause an animation and then restart it later? Thanks! |
|
In 2.x you can't pause it, you have to stop it and then animate it again. However at that point it will start from the beginning. You can just rebuild the Anim config again and pass it to the instance before you animate it again..
Does that help? |
Josh LizarragaYUI Contributor
|
Yes! Thank you.
I used totalFrames - currentFrame to get the remaining frames, then used that to reanimate. |
|
Hi,
How do you rebuild the config and pass it to the instance? |
Josh LizarragaYUI Contributor
|
Keep track of the duration of the animation in a variable:
Code: var oAnimTime = 10; // Seconds. Then use the onComplete event to rebuild oAnimTime if the animation is paused: Code: var oAnim = new YAHOO.util.Anim(oTarget, { top: { to: 0 } }, oAnimTime, YAHOO.util.Easing.easeNone); oAnim.onComplete.subscribe(function(){ if(oSomeFlagThatDeterminesIfAnimWasPaused){ oAnimTime = (oAnim.totalFrames - oAnim.currentFrame)/1000; // Divided by 1000 to get seconds. } }); So when you rebuild the animation, oAnimTime is how many seconds were left instead of 10 seconds. |
| Page 1 of 1 | [ 5 posts ] |
| You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum |
© 2006-2013 Yahoo! Inc. All rights reserved.
All code on this site is licensed under the BSD License unless stated otherwise.
About This Site · Security Contact Info
Powered by phpBB® Forum Software © phpBB Group