Share Posted February 27, 2020 Greetings! My apologies in advance if the answer to this question exists somewhere. I have had a look but I've not been able to spot anything conclusive. I've used TweenMax exclusively for years in my HTML5 banners, and sometimes my banners have quite a lot of animation going on throughout. However there are typically time limits for animation (after which no animation can be going on), so when it comes to stopping every animation, I used to rely on the extremely useful TweenMax.killAll(); to end everything at the same time; particularly useful when there are dozens of animations (on smaller things) running at the same time. Though GSAP 3 was released a while back, I've only just begun to adopt it into my banner development process. However, it seems (unless I am mistaken - and please do correct me if I'm wrong) that killAll() no longer exists as a function. I'm sure there's a very good reason for this, and I know I can still kill the animations of everything individually, but it seems like unnecessary extra custom code I now need to write when there was previously a function to do this automatically for every single active tween, in one single stroke. Am I missing something? Is there a plugin or something else I have been embarrassingly oblivious to? Many thanks! Link to comment Share on other sites More sharing options...
Share Posted February 27, 2020 Hey DapperDirewolf and welcome to the GreenSock forums! Yes, I believe .killAll() has been deprecated. Why not pause the global timeline instead? gsap.globalTimeline.pause() See the Pen bGdWEbR?editors=0010 by GreenSock (@GreenSock) on CodePen If all of your tweens are on DOM elements you could also use gsap.killTweensOf("*"). 1 1 Link to comment Share on other sites More sharing options...
Author Share Posted February 27, 2020 Perfect and immediate solution to my problem. I feel an absolute fool for not realising these options existed! Thanks heaps! Link to comment Share on other sites More sharing options...
Share Posted February 27, 2020 5 minutes ago, DapperDirewolf said: I feel an absolute fool for not realising these options existed! Don't, I learn things about GSAP fairly regularly, haha 1 1 Link to comment Share on other sites More sharing options...
Share Posted February 27, 2020 Sure, how about this? gsap.globalTimeline.clear() That way, you're not pausing the entire timeline from that point on (which would mean future animations wouldn't play). Clearing a timeline just dumps all of its child animations. 👍 I just added a note in the Migration Guide about this: 6 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