Jump to content
Search Community

TimelineLite Confusion [SOLVED]

CantinaDan test
Moderator Tag

Recommended Posts

For some reason the code below is not functioning the way I assume it should. I'm sure the mistake is mine but I can't figure it out. I want the pic1_mc to disappear after the wipe1_mc does its thing. ie - first a 1.5 sec delay, then a .5 sec wipe, then the pic's alpha goes to zero. But when I test the movie the pic's alpha is zero right from the get go. Can't figure out why its not waiting until after that first append line of code. Any insight would be much appreciated!

 

var imageAni:TimelineLite = new TimelineLite();
	imageAni.append(TweenLite.to(wipe1_mc, .5, {y:324, delay:1.5}));
	imageAni.append(TweenLite.to(pic1_mc, 0, {alpha:0}));

Link to comment
Share on other sites

It's because TimelineLite by default sets align to "normal", not "sequence."

 

var imageAni:TimelineLite = new TimelineLite();
imageAni.appendMultiple([TweenLite.to(wipe1_mc, 0.5, {y:324, delay:1.5}),
 						     TweenLite.to(pic1_mc, 0, {alpha:0})], 0, "sequence");

Link to comment
Share on other sites

Actually, it's because tweens with a duration of zero will render IMMEDIATELY (if you think about it, that kinda makes sense) but you can prevent that default behavior by passing immediateRender:false in the vars object.

 

var imageAni:TimelineLite = new TimelineLite();
imageAni.append(TweenLite.to(wipe1_mc, .5, {y:324, delay:1.5}));
imageAni.append(TweenLite.to(pic1_mc, 0, {alpha:0, immediateRender:false}));

 

The other option is to set the duration to a very small value like 0.001. But again, that's not necessary if you do immediateRender:false.

Link to comment
Share on other sites

Just one more question related to this :D

 

I'd like to use the number that is calculated in my distance vars as a relative amount to move a movieClip in my TimelineLite. (I actually just recently realized that by putting a number in quotes it moves it that amount of pixels. Yeah, I'm slow.) If I have the actual number in quotes it functions properly. But if I put the var in quotes ("distanceV") it doesn't work properly. In this case it doesn't travel far enough? If I trace "distanceV" and "distanceH" I get the proper number in the output.

 

var distanceV:Number = stage.stageHeight + wipe1_mc.height;
var distanceH:Number = stage.stageWidth + wipe2_mc.width;

rockOn();

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

	imageAni.append(TweenLite.to(wipe1_mc, .3, {y:"distanceV", delay:2, ease:Linear.easeNone}));
	imageAni.append(TweenLite.to(mask1_mc, .3, {y:"distanceV", ease:Linear.easeNone}), -.3);

	imageAni.append(TweenLite.to(wipe2_mc, .3, {x:"542", ease:Linear.easeNone}), 2);
	imageAni.append(TweenLite.to(mask2_mc, .3, {x:"542", ease:Linear.easeNone}), -.3);

	imageAni.append(TweenLite.to(wipe3_mc, .3, {y:"-674", ease:Linear.easeNone}), 2);
	imageAni.append(TweenLite.to(mask3_mc, .3, {y:"-674", ease:Linear.easeNone}), -.3);

	imageAni.append(TweenLite.to(wipe4_mc, .3, {x:"-542", ease:Linear.easeNone}), 2);
	imageAni.append(TweenLite.to(mask4_mc, .3, {x:"-542", ease:Linear.easeNone}), -.3);
}

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