Jump to content
Search Community

Find timeline instance by Id?

wpsoul test
Moderator Tag

Go to solution Solved by Rodrigo,

Recommended Posts

I am using timeline to add some pause in Horizontal scroll, but I need to find Tween instance of container automatically with getTweensOf function. Unfortunately it works only if I use tweens without timeline. As I inderstand, I need to get timeline instance first, then, search with getTweensOf inside timeline https://greensock.com/docs/v3/GSAP/Timeline/getTweensOf() 

 

But how can I get timelines objects on page which is attached to container? I tried to add id to timeline but this doesn't work

Link to comment
Share on other sites

  • Solution

Hi,

 

Could you provide a simple codepen that illustrates the situation?

 

Also keep in mind that there are several ways to find a tween and/or timeline.  In the case of an animation in a ScrollTrigger instance you can access the animation property of said ScrollTrigger instance:
https://greensock.com/docs/v3/Plugins/ScrollTrigger/animation

 

Then you can use on that GSAP instance the getChildren or getById methods:
https://greensock.com/docs/v3/GSAP/Timeline/getChildren()

https://greensock.com/docs/v3/GSAP/Timeline/getById()

 

Happy Tweening!!!

  • Like 1
Link to comment
Share on other sites

Thank you, this was helpful. For first try I resolved by wrapping all code with new gsap.context() function and attaching to global variable making it available for other scripts. But solution with getting Scrolltrigger is better because I don't need global variables. I confirm that it's working

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