Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
bonassus

add tween to the middle of a timeline without changeing the totalDuration.

Recommended Posts

Ok i'm confused again.

 

I have an animaion based on the tween of marker. the position of multiple objects are updated based on markers position.

 

tl.append( TweenLite.to(marker, 10, {x:1000}));
private function loop(e:Event){
		area1.x = marker.x;
		area2.x = area1.x +	area1.spacing.width;
		area3.x = area2.x + area2.spacing.width;
}

 

I want to be able to add tweens to the middle of tl without adding to its 10 second duration so that i can add lables based on this 10 second duration.

 

tl.addLabel("label1", .01);
		tl.addLabel("label2", 3);
		tl.addLabel("label3", 5.26);
		tl.addLabel("label4", .77);
		tl.addLabel("label5", 10);

 

I want to put all tweens in tl to be able to reverse it.

 

if i insert a tween at .01 seconds like this:

tl.insert(TweenLite.to(area1.window.background,4,{x:someWidth}), .01);

it adds 4 seconds to tl's total duration which i want to be 10 seconds.

 

I thought about using more then one timeline and starting them with callback functions on the lables but that gets tricky with reversing the timeline.

 

I know there is an elegant way to do this with timlineMax but I can't think of it.

help would be appreciated.

 

Thanks!

Link to comment
Share on other sites

that's unexpected. Inserting a 4 second tween at the beginning of a 10 second timeline should not make the duration go beyond 10.

 

are you sure there isn't anything else in your timeline?

 

I made a simple test that worked as expected

 

var tl:TimelineMax = new TimelineMax();
tl.append(TweenMax.to(mc1,10,{x:400}));
trace(tl.duration); //output 10
tl.insert(TweenMax.to(mc2, 4, {x:400}), .01);
trace(tl.duration); //output 10

 

If you can replicate the duration changing in the simplest file possible, please post it and I will have a look. From what you have explained quite clearly, you should not be getting the results you are getting.

 

also, just to be super clear, since you used the term total duration... keep in mind that totalDuration includes any repeats and repeat delays. duration is just the amount of time that a timeline takes to play through once.

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