mvaneijgen Posted February 21, 2023 Posted February 21, 2023 I want to get the start value in pixels of a specific ScrollTrigger, so what I did was log the timeline, then saw there was a scrollTrigger object. Within that object I saw the property start, but when I log tl.scrollTrigger.start I get 0. Am I missing something? See the Pen MWqKLww?editors=1111 by mvaneijgen (@mvaneijgen) on CodePen.
Solution akapowl Posted February 21, 2023 Solution Posted February 21, 2023 Hey Mitchel. ScrollTriggers associated with timelines must wait 1 tick to do their calculations, so you could e.g. use a delaydCall to get what you need. See the Pen wvEMNLa by akapowl (@akapowl) on CodePen. You can find a more thorough explanation by Jack in this recent thread (among others). 4 1
mvaneijgen Posted February 21, 2023 Author Posted February 21, 2023 Thanks Paul! I was reality stomped on this one! Thanks again! 4
Cassie Posted February 21, 2023 Posted February 21, 2023 Good to see even the experts get tripped up sometimes ? 1
GreenSock Posted February 21, 2023 Posted February 21, 2023 Yep, exactly right. Also, you don't HAVE to wait 1 tick. The whole point is that there's no way for GSAP to know when you're done populating your timeline, so it has to wait a tick but since YOU know when you're done populating your timeline, you can manually trigger the refresh() at that point: See the Pen MWqyeRB?editors=1010 by GreenSock (@GreenSock) on CodePen. 4
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