Jump to content
Search Community

Has killAll() been deprecated in GSAP 3?

DapperDirewolf test
Moderator Tag

Recommended Posts

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

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("*").

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

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: 

 

  • Like 6
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...