Hello fine folks with a single green sock on,
I've scratched my head a bit on this one and found no remedy but call upon you.
So here I have a horizontal animation that consists in a moving backdrop (data-background) with a series of absolutely positioned items (data-tag) atop. So far so good.
What I need now is animating the tags when they enter the scene (here a simple class addition -> I didn't use toggleClass on purpose by the way), i.e. when they reach the containerAnimation defined zone (as per the official example https://codepen.io/GreenSock/pen/WNjaxKp).
I am able to do it but I don't understand how to combine the simple horizontal movement (my animateTags() function) + the scrollTrigger that is passed to each tag. First I thought I could do it in a single gsap.to() but it didn't work and so I attached the two of these to all tags, expecting them to run at the same time thanks to timeline.add(..., 0) but it doesn't seem to fit the bill. As the markers show the tags and their respective triggers' movement keep drifting.
My question is then the following: how can I combine both gsap.to() in a single call or how can I synchronize both movements?
Thank you in advance!
By the way you'll have to open the pen in Codepen because in this iframe the tags are not visible.