TomTim Posted February 17 Share Posted February 17 Hi all, I am new in GSAP! I want to make a universal code for working with parallax on attributes. Maybe someone has their own option, please share. I tried to write own, but it doesn't work correctly. See the Pen xxBBwPO by wthawk (@wthawk) on CodePen Link to comment Share on other sites More sharing options...
Solution mvaneijgen Posted February 17 Solution Share Posted February 17 Hi @TomTim welcome to the forum! You'd defined a timeline outside everything and add all the tweens to a that timeline then on scroll of the ScrollTrigger it would play all the tweens of the one timeline and then quickly reset it for the next timeline. If you scope the timeline to the current loop (and the ScrollTrigger to) everything works as expected. This is all built in to ScrollSmoother https://gsap.com/docs/v3/Plugins/ScrollSmoother/, if you're are looking for a robust implementation of this function. Hope it helps and happy tweening! See the Pen wvOOKVO?editors=0010 by mvaneijgen (@mvaneijgen) on CodePen 1 Link to comment Share on other sites More sharing options...
TomTim Posted February 18 Author Share Posted February 18 Thank you so much for your advice, you helped me a lot! 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