Jump to content


is tweenlite active?

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

How do I determine if a tweenlite instance is active?  If it hasn't started, I know the tween is paused.  When it has completed is it also paused? 

Link to comment
Share on other sites

No no, the tween is never paused unless you specifically pause it on purpose. That's intentional, because pausing a tween/timeline is like saying "lock the playhead where it is - don't let the parent timeline control the playhead)". The engine won't force a tween or timeline to become unpaused either without you specifically requesting that - it honors your choice. 


TweenMax has an isTweening() method that you could use to find out of a particular object is actively tweening. Otherwise, if you just have a specific tween instance that you want to know the state of, you could check a few things, depending on what exactly you mean by "active":

  1. You could check to see if the time() is between 0 and its duration() and you can check its paused state using paused(). Like if (tween.time() > 0 && tween.time() < tween.duration() && !tween.paused()) {...}
  2. Technically, if it's nested in a timeline (especially if that timeline is nested inside another one or more), you could move up the chain and check to make sure none of the ancestor timelines are paused. To get to the parent timeline, just get the "timeline" property of the tween or timeline. 

TimelineMax has a getActive() method too if you want to find the children that are currently active. 


Lots of options - sorry of that was confusing :)

  • Like 1
Link to comment
Share on other sites

Option 1 works great.  Thanks for the suggestions.

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.