Jump to content
GreenSock

the_bowwer

callback a curently running timeline before its end

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

Hi, 

 

I would like to know how can i repeat this animation using TimelineMax : 

See the Pen hcjKl by anon (@anon) on CodePen



So that when the bottom reversed text comes back up, the text above goes up again ( the start of the timeline actually ).

 

Tell me if you need more explanations .

 

Thanks !

Link to comment
Share on other sites

Hi and welcome to the GreenSock forums.

 

Neat animation you have there.

 

If I understand you correctly, this should do the trick:

http://codepen.io/GreenSock/pen/hAtsj

 

You'll notice I simplified the code a bit as I didn't think 2 timelines were necessary.

Link to comment
Share on other sites

Also, thanks a ton for making the CodePen demo. It was super helpful.

Link to comment
Share on other sites

Thanks a lot you saved me hours of research ! I'm kind of new using your libraries so that permits me to understand better how it works. Thanks !

Link to comment
Share on other sites

Another question : How can I wait until the end of the animation to stop it ?

At some point the numbers are at "100", and I need to end the animation.

Link to comment
Share on other sites

Hi,

 

I'm assuming that you're tracking the number in the container, so when that number gets to 100 you can remove the call instance by using the removeCallback() method. All you have to do is add a label to the call instance in order to make it easier to remove, like this:

var tl = new TimelineMax();
tl.to(_$topP, 1, { top:11 })  
  .to(_$topP, 1, { top:52 }, "topDown")// add 2 tweens at topDown label
  .to(_$botP, 1, { top:-10 }, "topDown")
  .to(_$botP, 1, { top:-52 }, "bottomUp")// add 2 tweens at bottomUp label
  .to(_$topP, 1, { top:11 }, "bottomUp")
  //next call tl.play("topDown")
  .call(tl.play, ["topDown"], tl,"callBack");

Then you check for the number in the container and execute the removeCallback() method:

if(number === 100)
{
  tl.removeCallback(tl.play, "callBack");
}

Like that the next timeline cycle will be the last one because the call to make it play again will be gone.

 

Rodrigo.

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