Jump to content
Search Community

Change a tween in timeline before reversing

phillyj8 test
Moderator Tag

Recommended Posts

I have a situation where I have a TimelineMax that I've created with a sequence of TweenLites. I'd like to reverse back through it but before I do so, I need to change the first TweenLite in the array (which will be now be the last) and swap it out with something else.

 

For example, lets say there is mc at x:0, y:0, and I do this:

 

myTimeline.append(new TweenLite(mc, .2, {x:100, y:100}));
myTimeline.append(new TweenLite(mc, .2, {scaleX:10, scaleY:10}));
myTimeline.append(new TweenLite(mc, .2, {x:0, y:200}));

 

Then, I want to reverse it after its done playing, but instead of it going back to x:0, y:0, I want it to end at x:500, y:500, and not pass through x:0, y:0 (its original starting point) at all.

 

Is that possible? I've tried using append and prepend before I reverse it, but to no avail.

 

Thank you.

Link to comment
Share on other sites

Sure, you could kill() that first tween and insert() another one that goes to the values you want. It'd probably be best to do a TweenMax.fromTo() so that you can control the starting and ending values in this case. Kinda like:

 

var firstTween:TweenLite = new TweenLite(mc, .2, {x:100, y:100})
myTimeline.append(firstTween);
myTimeline.append(...other tweens...);

//then later...
firstTween.kill();
firstTween = TweenMax.fromTo(mc, .2, {x:500, y:500}, {x:100, y:100});
myTimeline.insert(firstTween, 0);

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...