Jump to content


timeScale change to timeline

Go to solution Solved by GreenSock,

Recommended Posts

I'm having trouble applying timeScale changes to a timeline. If I comment out the timeScale part, then the timeline replays, but with it in, it stops. 


See the Pen ExbjxKm?editors=1111 by geedix (@geedix) on CodePen

Link to comment
Share on other sites

Thanks for reporting. Standby while we look into the issue.


  • Like 1
Link to comment
Share on other sites

  • Solution

Good catch, @geedix. Sorry about that - it should be fixed in the next release which you can preview [compressed] at https://assets.codepen.io/16327/gsap-latest-beta.min.js


This is very specific to when you alter the timeScale of the parent timeline from within a child's onComplete that's at the VERY end of the timeline. Super rare :) In the final render of that parent timeline, it's basically saying "I reached the end, so pop me off my parent's timeline so I won't render anymore" but technically you just forced it back in by restarting it from inside that child's onComplete. So there are some other easy fixes (if you don't want to update to the latest beta): 

  1. Move your onComplete to the timeline instead of the child
  2. -OR- do your .restart() OUTSIDE of that onComplete. You could use a simple setTimeout() like:
    onComplete: () => {
      tl.timeScale(gsap.utils.random(0.5, 3));
      setTimeout(() => tl.restart(), 1); // now it'll happen outside this function


Does that clear things up? 

  • Like 1
Link to comment
Share on other sites

Thanks, I appreciate the explanation and solutions.

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.