Jump to content
GreenSock

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

Pause time line for a set period of time, then continue

Recommended Posts

Hello all,

 

I'm sure I'm being pretty dumb here as there must be an easier way of doing this.

 

In my code below I've used an mc called delay_mc, that is off stage and out of view, and is simply there to pause my timeline.

 

It works, but seems over the top.

 

Thanks in advance,

 

Barry

 

 

var timeline:TimelineMax = new TimelineMax();
timeline.append( new TweenLite(Text1_mc, 1, {scaleX:1, scaleY:1, x:600, y:200, alpha:1, ease:Circ.easeIn}) );
timeline.append( new TweenLite(Text2_mc, 0.5, {x:370, y:255, alpha:1, delay:0.5}));
timeline.append( new TweenLite(delay_mc, 0.1, {scaleX:1, delay:5, onComplete:FirstText}));
function FirstText():void {
   Text1_mc.gotoAndPlay(2);
Text2_mc.gotoAndPlay(2);
}

Link to post
Share on other sites

Also, I used my delay_mc tween to add the onComplete callback.

 

Can I pause the timeline for a period of time and then call the function?

 

Thanks,

 

Barry

Link to post
Share on other sites

Hi,

 

Good question. Yes, you don't need to add fake tweens to the timeline in order to delay the calling of a function.

 

in v12 (recommended) you can use append() to add a callback like so:

 

 

 


timeline.append( new TweenLite(Text1_mc, 1, {scaleX:1, scaleY:1, x:600, y:200, alpha:1, ease:Circ.easeIn}) );
timeline.append( new TweenLite(Text2_mc, 0.5, {x:370, y:255, alpha:1, delay:0.5}));

timeline.append(FirstText, 2);// call function 2 seconds after last tween finishes

 

http://api.greensock.com/as/com/greensock/TimelineLite.html#append()

 

If you are using v11, take a look at addCallback()

http://www.greensock.com/as/docs/tween/com/greensock/TimelineMax.html#addCallback()

 

Keep in mind, with both methods, the timeline isn't paused, there is just dead time between the last tween playing and your function being called.

Link to post
Share on other sites

Thanks Carl, you're a star!!

 

I've just signed up to Club Greensock for two reasons really.

 

1. so I could get my hands on the motion blur feature.

And 2. so I could show my apprecation of the platform.

 

I love the GSAP!

 

If it isnt in there already, will the motion blur be available for JS?

 

Thanks,

 

Barry

  • Like 1
Link to post
Share on other sites

Hi Barry,

 

Welcome to the club!

 

As for the MotionBlurPlugin, I think the best answer you are going to get is 'eventually'. Work is currently underway to implement some CSS3 features that are only available in newer browsers (3D transforms, shadows, etc).

 

Don't worry, as a Club member you will be one of the first to know when new features are ready.

 

-c

Link to post
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.

×