wpsoul Posted September 3, 2022 Share Posted September 3, 2022 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 More sharing options...
Solution Rodrigo Posted September 3, 2022 Solution Share Posted September 3, 2022 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!!! 1 Link to comment Share on other sites More sharing options...
wpsoul Posted September 3, 2022 Author Share Posted September 3, 2022 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 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now