PG1 Posted September 21, 2021 Share Posted September 21, 2021 Hi, I've spent a lot of time building many animations in a project and would like to run them at 2x in my production app. I've been suing dev tools up until now but obviously won't in prod. Wondering if I need to go through and half all timings, or if there is a setting I can use which will allow me to set the timeline play speed somewhere in my code - feels like it would be much easier! Cheers! Link to comment Share on other sites More sharing options...
Solution nico fonseca Posted September 21, 2021 Solution Share Posted September 21, 2021 Hey @PG1 you can use .timeScale() method to change the velocity of your timeline 🙂 See the Pen 2bf967d372822e74956540bc54c5650e by nicofonseca (@nicofonseca) on CodePen 3 Link to comment Share on other sites More sharing options...
PG1 Posted September 21, 2021 Author Share Posted September 21, 2021 Legend, thanks!! Link to comment Share on other sites More sharing options...
GreenSock Posted September 21, 2021 Share Posted September 21, 2021 Advanced tip: if you've got a ton of different animations created (not all in one timeline), you can merge EVERYTHING into one timeline with gsap.exportRoot() which returns a timeline and then you can set its .timeScale() to whatever you want. You could also control the timeScale of the entire global timeline like gsap.globalTimeline.timeScale(2), for example, but be careful because that affects everything including delayedCalls and everything in the future as well. If you can just put everything into a timeline and edit its timeScale(), that's probably best. I figured I'd mention some alternatives, though. 1 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