Jump to content
Search Community

Set Tween Time to Timeline Duration

CantinaDan test
Moderator Tag

Recommended Posts

I'm working on a Tweening sequence that I've built in TimelineLite. Goes kinda like this:

 

function rockOn():void
{
		var setA:TimelineLite = new TimelineLite({onComplete:rockOn});

		setA.append(TweenLite.to(typeA_mc, 1, {alpha:1}));
		setA.append(TweenLite.to(typeA_mc, 2, {alpha:0}), 2);
		setA.append(TweenLite.to(backgroundA_mc, 2, {alpha:0}), -2);


		setA.append(TweenLite.to(typeB_mc, 1, {alpha:1}));
		setA.append(TweenLite.to(typeB_mc, 2, {alpha:0}), 2);
		setA.append(TweenLite.to(backgroundB_mc, 2, {alpha:0}), -2);


		setA.append(TweenLite.to(typeC_mc, 1, {alpha:1}));
		setA.append(TweenLite.to(typeC_mc, 2, {alpha:0}), 2);
		setA.append(TweenLite.to(backgroundC_mc, 2, {alpha:0}), -2);


		setA.appendMultiple(TweenMax.allTo([backgroundA_mc, backgroundB_mc, backgroundC_mc], .01, {alpha:1}));
}

 

As all of that is happening I want another Tween to happen that starts as soon as this one starts and has its duration set to the duration of setA, whatever that ends up being. The Tween I want to overlay looks like this:

 

var SW:TimelineLite = new TimelineLite();
			SW.append(TweenLite.to(SW_mc, .01, {x:-350}));
			SW.append(TweenLite.to(SW_mc, 20, {x:938}));

 

What would be the best way of accomplishing that? Is there a way I can insert this additional Tweening sequence in the original Timeline?

 

Thanks VERY much!

Link to comment
Share on other sites

What would be the best way of accomplishing that? Is there a way I can insert this additional Tweening sequence in the original Timeline?

 

By "original Timeline" do you mean your setA? If so, sure. You can simply insert() the tween (or TimelineLite/Max) into that TimelineLite whenever you please. If you want the duration to match, you can actually set that directly. The cool thing about TimelineLite/Max is that if you adjust its duration, it will simply tweak the timeScale to make the TimelineLite last that long. Kinda like:

 

SW.duration = setA.duration;
setA.insert(SW, 0); //not entirely necessary

 

Does that answer your question?

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