geedix Posted January 27, 2022 Share Posted January 27, 2022 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. thanks See the Pen ExbjxKm?editors=1111 by geedix (@geedix) on CodePen Link to comment Share on other sites More sharing options...
OSUblake Posted January 27, 2022 Share Posted January 27, 2022 Thanks for reporting. Standby while we look into the issue. 1 Link to comment Share on other sites More sharing options...
Solution GreenSock Posted January 28, 2022 Solution Share Posted January 28, 2022 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): Move your onComplete to the timeline instead of the child -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? 1 Link to comment Share on other sites More sharing options...
geedix Posted January 28, 2022 Author Share Posted January 28, 2022 Thanks, I appreciate the explanation and solutions. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now