Jump to content
Search Community

How to tell if GSAP animation is still running with TweenMax.to?

gsapluvah test
Moderator Tag

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

Hello fellow GreenSock users!

 

I'm new to GSAP and I'm using the TweenMax.to method to change the "top" css property of several elements whenever a click occurs on a navigation element...  Problem is I need for that to not happen if the animation of the previous click is still in progress...

 

I see that in the documentation for GSAP there is the public method "isActive", but I'm using TweenMax... not sure if I should even attempt at using those methods off of the TweenMax object or not - I'm guessing it wouldn't work.

SO... is there a way to determine if a TweenMax animation is active or inactive?  What are the differences between animations applied via TweenMax, TweenLite, and Timeline?

BEST regards,
gsapluvah!

  • Like 1
Link to comment
Share on other sites

Hi and welcome to the GreenSock forums,

 

TweenMax extends TweenLite which means it inherits all the methods and properties of TweenLite and then has some of its own.

 

Be sure to check the TweenMax docs: http://api.greensock.com/js/com/greensock/TweenMax.html#methodSummary

 

Notice under "Public Methods" you can toggle "show / hide inherited methods".

Also to the right of each method it shows where that method is defined. 

You'll see that some methods are defined in TweenMax, TweenLite and others the Animation base class.

 

Also notice that TweenMax has an isTweening() method which instead of telling you if an animation is active, it tells you if an object is being tweened. 

 

So you can do 

 

if (TweenMax.isTweening(someButton) === false) {

  //do some other tween

}

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