Jump to content
Search Community

Restarting a stored tween?

dada78 test
Moderator Tag

Recommended Posts

Hi,

I am getting a bit confused after looking at all the different restart of a tween examples...

All I would like to do is store one tween (myTween) in a variable and later restart that tween. Here is my code:

import com.greensock.TweenMax;
import com.greensock.TimelineLite;
import com.greensock.easing.*;

var tl = new TimelineLite();

var myTween:TweenMax = new TweenMax(card, .5, {x:148, y:168, scaleX:1, scaleY:1, blurFilter:{blurX:0, blurY:0, remove:true}});


//runs the card unblur function .2 seconds into the previous tween
tl.add([cardReg],  "-=0.1")


tl.to(txt1, 1, {alpha:1}, "+=1")
  .to(card, .4, {alpha:0, scaleX:3, scaleY:3}, "+=1")
  .restart(myTween);

 
stop();

Please advise. Thanks!

Link to comment
Share on other sites

you can restart your tween at any time like this

myTween.restart()
 
you can restart your timeline at any time with 
tl.restart();
However it appears you are trying to restart your tween at some point in your timeline, which is not the same as just restarting a tween or timeline on its own (shown above).
tl.restart(myTween) // not proper usage of the restart method

i think what you want to do is use TimelineLite.call() to call myTween's restart() method like so:

tl.to(txt1, 1, {alpha:1}, "+=1")
  .to(card, .4, {alpha:0, scaleX:3, scaleY:3}, "+=1")
  .call(myTween.restart)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...