Jump to content
Search Community

TimelineMax with TweenAlign.START, 0.2 [SOLVED]

peterPotter test
Moderator Tag

Recommended Posts

I have a bunch of MovieClips and I am trying to animate each clip's z property (using yoyo), but I want the start time for each TweenLite animation to stagger. here is my code:

 

var timeline:TimelineMax = new TimelineMax({repeat:1, yoyo:true, repeatDelay:0, TweenAlign.START, 0.2});
	for(var i:int=0; i < mainClip.thumbPanel.numChildren; i++)
		{
			var thisThumb:MovieClip = MovieClip(mainClip.thumbPanel.getChildAt(i));
			timeline.insert( TweenLite.to(thisThumb, 0.2, {z:-700, ease:Expo.easeOut}) );
		}

 

I know my syntax (TweenAlign.START, 0.2) is incorrect. What is the correct syntax?

 

Thanks very much. Usually I figure out these things on my own, but I am on a tight schedule with the project I am developing. Sorry for the few questions.

Link to comment
Share on other sites

You could accomplish this many ways. Here's one:

 

//create an array that stores all our tweens for insertion later
var myTweens:Array = []; 

//create a tween for each child, dump it into the array
for (var i:int = 0; i     myTweens.push( TweenLite.to(mainClip.thumbPanel.getChildAt(i), 0.2, {z:-700, ease:Expo.easeOut}) );
}

//dump them into a timeline that staggers the start time of the tweens by 0.2 seconds (and yoyo the timeline)
var timeline:TimelineMax = new TimelineMax({tweens:myTweens, repeat:1, yoyo:true, repeatDelay:0, align:TweenAlign.START, stagger:0.2});

 

Then you can control the whole sequence easily with the timeline instance - pause(), resume(), reverse(), play(), restart(), gotoAndPlay(), etc.

 

Another option would be to use the TweenMax.allTo() method in conjunction with the appendMultiple() or insertMultiple() methods of TimelineMax/Lite. Either way works fine. There are some other ways too, but I don't want to confuse anyone :)

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