Jump to content
Search Community

get last animated items

OxXxigen 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

There isn't a single method that tells you that.

It would really help to know why you want to know which objects are tweening and what you intend to do with them.

 

If you want to pause or kill them all, you can use TweenMax.pauseAll() or TweenMax.kilAll() (TweenMax docs).

 

You can also grab all active animations and export them to a single timeline using TimelineLite.exportRoot() : https://greensock.com/docs/TimelineLite/static.exportRoot()

 

Once all the tweens are in a timeline you can use getChildren() to get an array of all the children: https://greensock.com/docs/TimelineLite/getChildren() and then investigate the targets of those tweens.

 

If none of that helps, please provide a reduced test case that clearly illustrates what you need to do. Thanks.

  • Like 2
Link to comment
Share on other sites

i use it to know, when element change size/position.

for example, i have element A, and element B which behaves like a reflection in a mirror.
element A can change it size/position from a different places, and when i create element B, i just whant to cacth all tweens, and check target , if it's element A, then do what i do.

Link to comment
Share on other sites

Is this what you're looking for? https://greensock.com/docs/TweenLite/static.getTweensOf()

 

A set() is just a zero-duration tween, FYI. 

 

I'm a little confused, though, about why you're doing it this way. Seems like there may be a cleaner way to accomplish what you're after but I may be misunderstanding. If you want to dynamically add other elements that are following the same movements/opacity or whatever, why not just use a container element?  (Tween the container, add elements to it whenever). 

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