beavykins Posted April 10, 2022 Share Posted April 10, 2022 Is it possible to pass in the end position of a previously pinned scrollTrigger element as the start position of another? Basically I have two timelines, the first one has a pin with a pinSpacer and I want to then have another timeline start when the previous one unpins, is that possible? At the moment I have it working by manually calculating the start position in the next timeline but it seems like there is probably a ‘simpler’ way. Thanks! Link to comment Share on other sites More sharing options...
GreenSock Posted April 10, 2022 Share Posted April 10, 2022 Sure! There are a few ways... let tl = gsap.timeline({ scrollTrigger: { ... } }); let otherTL = gsap.timeline({ scrollTrigger: { start: () => tl.scrollTrigger.end, // function-based value ... } }); That assumes you create them in the proper order so the first one gets refreshed before the second one (its start/end values are calculated by the time the following one has to read them). If you know for sure it's the previous one, you could also do this: let otherTL = gsap.timeline({ scrollTrigger: { start: self => self.previous().end } }); I'm just assuming you're using timelines but this same thing works regardless - use it in ScrollTrigger.create() or in a tween or whatever. Is that what you were looking for? 1 Link to comment Share on other sites More sharing options...
beavykins Posted April 10, 2022 Author Share Posted April 10, 2022 This looks just like what I need thanks! I’m on my phone at the moment so will give this a whirl when I get on the machine and will report back. loving your work, thanks again! Link to comment Share on other sites More sharing options...
beavykins Posted April 10, 2022 Author Share Posted April 10, 2022 It worked exactly how I wanted, thanks so much! 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