filips Posted August 7, 2022 Share Posted August 7, 2022 I want to animate a fixed div's width using sections as a trigger. The issue I'm running into is that on enter back the animation doesn't start from the width that the div was in after last change but rather jumps to the initial width and then animates. See the Pen VwXxRWg by FilipSipos (@FilipSipos) on CodePen Link to comment Share on other sites More sharing options...
GreenSock Posted August 7, 2022 Share Posted August 7, 2022 I noticed several problems: You were literally trying to animate the "end" property of the various elements. There is no such thing. Were you trying to set the end of the ScrollTrigger? You were animating the SAME element with a bunch of ScrollTrigger-based tweens which are always rendered immediately by default, so I assume you forgot to set immediateRender: false If I understood you correctly, you want to make the tweens dynamically pick up where the current size is, thus you should create them dynamically rather than pre-baking 1 tween for each and restarting them. Otherwise, they'll always play to/from the same values each time. That'd be bad, though, if someone scrolls more quickly and interrupts a previous one. Perhaps you wanted something more like this?: See the Pen XWEqGoB?editors=0010 by GreenSock (@GreenSock) on CodePen Nice and simple Happy tweening! Link to comment Share on other sites More sharing options...
filips Posted August 7, 2022 Author Share Posted August 7, 2022 Oh I wish I had asked sooner😅🤣 thanks that is exactly what I was trying to create! 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