Jump to content
Search Community

timeScale change to timeline

geedix test
Moderator Tag

Go to solution Solved by GreenSock,

Recommended Posts

  • 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

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