flim Posted April 14, 2022 Share Posted April 14, 2022 Is it possible to unset all animation, I want to check if media query change, no animation for all elements. See the Pen GRyYjdN by fredericklim (@fredericklim) on CodePen Link to comment Share on other sites More sharing options...
Solution Cassie Posted April 14, 2022 Solution Share Posted April 14, 2022 Hey there! This is always a little more complex than just killing all animations. If an animation serves an important purpose, e.g fading and animating in a modal, if you kill it, then that functionality is broken. 🙃 If they're purposeful animations - I would recommend making all your animations *superfast* e.g...gsap.globalTimeline.timeScale(999) If you do actually want to kill all your animations you could use... gsap.globalTimeline.clear() Hope this helps! 3 Link to comment Share on other sites More sharing options...
flim Posted April 14, 2022 Author Share Posted April 14, 2022 I update my CodePen, gsap.globalTimeline.clear() seem not work as desired, gsap.globalTimeline.timeScale(999) works great. Many thanks! Link to comment Share on other sites More sharing options...
Gad Posted June 21, 2022 Share Posted June 21, 2022 how to set this : gsap.globalTimeline.clear() on specific screen size like resetting animation on mobile devices? Link to comment Share on other sites More sharing options...
GreenSock Posted June 21, 2022 Share Posted June 21, 2022 gsap.globalTimeline.clear() simply removes all animations from the global timeline. It doesn't actually revert anything. Are you trying to revert all animations? You might want to look into ScrollTrigger.matchMedia() and ScrollTrigger.saveStyles(). Link to comment Share on other sites More sharing options...
flim Posted July 7, 2022 Author Share Posted July 7, 2022 I want to reset the animation to the beginning of the animation when switching from desktop to mobile screen, not revert playback. Now I just check mediaquery to reload the page without animation when switching to mobile, or set animation when change to the desktop view. Link to comment Share on other sites More sharing options...
Cassie Posted July 7, 2022 Share Posted July 7, 2022 maybe anim.progress(0).pause() ? There's lots of different timeline methods. If you take a little whizz through the docs you should be able to find the combo that works for you!https://greensock.com/docs/v3/GSAP/Timeline/pause() 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