Jump to content
Search Community

Controlling a movieclips timeline using timelinemax

squibn test
Moderator Tag

Recommended Posts

Hi there,

 

I can't seem to work out how to control a movieclips timeline whilst working with timelinemax?

What I've got is a series of animations which are scripted but one of those animations is keyframed on one of the movieclips timeline.

 

So what I'm trying to do is let the scripted animations run through, but the movieclip animation hold until its turn to play through, then once its played carry on with the scripted animations, so my code so far looks like this, and I'll show the point that I want the keyframed animation to play through...

 

var myTimeline:TimelineMax = new TimelineMax();

myTimeline.append(TweenMax.from(logo, 0.5, {autoAlpha:0, ease:Back.easeOut}));
myTimeline.append(TweenMax.from(baseTint, 0.5, {_yscale:0, ease:Back.easeOut}));
////////////////////////
Movieclips keyframed animation here...
////////////////////////
myTimeline.append(TweenMax.from(mainHeadline, 0.5, {autoAlpha:0, ease:Back.easeOut}));

myTimeline.play();

 

I tried using "frameLabel" but lost my way!

 

If I'm not explaining my self very well I'll try make things more clear, but basically its scriped animation, then a movieclips timeline animation, then back to scripted animation.

Any help would be superb!

 

Cheers,

Squibn

Link to comment
Share on other sites

You want to play that whole MovieClip, right?

 

It should be as simple as this (in AS2):

clip.stop(); //stop the MovieClip initially.
var myTimeline:TimelineMax = new TimelineMax();

myTimeline.append(TweenMax.from(logo, 0.5, {autoAlpha:0, ease:Back.easeOut}));
myTimeline.append(TweenMax.from(baseTint, 0.5, {_yscale:0, ease:Back.easeOut}));
////////////////////////
myTimeline.append(TweenMax.to(clip, framesToSeconds(clip, 30), {frame:clip._totalframes, ease:Linear.easeNone}));
////////////////////////
myTimeline.append(TweenMax.from(mainHeadline, 0.5, {autoAlpha:0, ease:Back.easeOut}));

myTimeline.play();

function framesToSeconds(mc:MovieClip, fps:Number):Number {
   return Math.abs(mc._totalframes - mc._currentframe - 1) / fps;
}

 

Basically it involves doing a "frame" tween and making sure that you properly calculate the duration based on the fps and the number of total frames in the MovieClip (that's what the framesToSeconds() method is for). Of course if your parent TimelineLite/Max had useFrames:true, you could define everything in frames including the duration, but it looks like your other tweens are seconds-based so I just did that.

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