Jump to content
GreenSock

manorius

Some help with TimelineLite and overwrite please

Moderator Tag

Recommended Posts

Hi Guys,

 

I'm breaking my head because I can't figure this one out...

How can I reuse an array of tweens multiple times without overwriting it?

In the bellow example the "animate2" always overwrites the "animate1" .

I've tried the ovewrite manager but no luck.

var myTimeline:TimelineLite = new TimelineLite();

myTimeline.addLabel("animate1", 0);
myTimeline.addLabel("move", 2);
myTimeline.addLabel("animate2", 4);

var animate:Array = new Array(new TweenLite(mcBall,1,{x:10}),new TweenLite(mcBall,1,{x:0,delay:1,overwrite:0}));

 myTimeline.insertMultiple(animate,"animate1");                            
 myTimeline.insert(new TweenLite(mcRect,1,{x:100}),"move");
 myTimeline.insertMultiple(animate,"animate2");

Link to comment
Share on other sites

You can't do that. Each tween has a specific startTime and parent timeline. In other words, one tween instance cannot be in two places at once.

Link to comment
Share on other sites

So does this mean that I have to dublicate the array every time I'm inserting multiple Tweens? Is there any other way for repeating a specific sequence of Tweens without having to rewrite them?

Link to comment
Share on other sites

Of course - if you want to repeat a set of tweens, you could put them into a TimelineMax that has its "repeat" property set to however many times you want it to repeat, and there's a "repeatDelay" property too that allows you to put time between the repeats. You can do the same kind of thing with an individual TweenMax instance too.

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