Jump to content
Search Community

TimelineMax change tween order.

giannosfor test
Moderator Tag

Recommended Posts

Is there a way to change the tween order after you append them in a Timeline,or play them in a different order?To be more specific in my example i animate an object,i rotate it and then moving it to x direction.I want when i reverse it to rotate first and then move back,no the other way around.Also another question,if i want to apply a delay on the timeline at the beginning a simply add as parameter,but how can i have also delay when i reverse it?

package {

import flash.display.MovieClip;
import flash.events.Event;
import flash.events.MouseEvent;
import fl.transitions.Tween;
import fl.transitions.easing.*;
import fl.transitions.TweenEvent;

import com.greensock.*;
import com.greensock.easing.*;

public class Document10 extends MovieClip {
	private var timeline:TimelineMax;
	private var flag : Boolean = true;

	public function Document10( )		{
		right.addEventListener(MouseEvent.CLICK, backState);
	}
	private function moveState (  )
	{	
		flag = false;
		timeline = new TimelineMax( ); 
		timeline.insertMultiple([ new TweenLite(right, 0.5, {rotation : 180 }), new TweenLite(right, 1, {x :15, ease:None.easeOut }) ], 0 , TweenAlign.SEQUENCE );
	}
	private function backState (  ev : MouseEvent )
	{	
		if (! flag )
			doneState( );
		else
			moveState( );
	}
	private function doneState (  )
	{	
		flag = true;
		timeline.reverse( );
	}

}
}

Link to comment
Share on other sites

read greensock's response here as far as shifting tweens around: viewtopic.php?f=1&t=6290

 

if you are reversing a timeline and expect it to do something different... chances are it would be much easier just to make a new timeline that does exactly what you want.

 

how is your timeline being reversed? is it by user interaction or are you yoyo-ing it with repeats?

 

there is a repeatDelay property as well for TimelineMax

Link to comment
Share on other sites

Thanks that really help.The repeat is by users interaction,i just added the repeatDelay property.

Yes create a new timeline would be much more efficient.Greensock's response gave me the answer,just address the timeline tweens to an array and

treat them the way you want.

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