B_wu Posted December 2, 2022 Share Posted December 2, 2022 Hello, I'm running into an issue with scrollTo. Codepen attached has an example where some animation happens, then the scroll begins. There is a replay button and the scroll text gets set back to the top, but on replay the text no longer scrolls. Is there a way to reset the autoKilll feature eachtime the replay button is clicked? I basically need the text to be able to scroll each time the replay button is pressed but setting it back to y:0 seems to trigger the autoKill. Any help is appreciated, thanks! See the Pen OJEaVZP by b_wu (@b_wu) on CodePen Link to comment Share on other sites More sharing options...
Rodrigo Posted December 3, 2022 Share Posted December 3, 2022 Hi @B_wu and welcome to the GreenSock forums! The issue here is that the auto kill feature of the ScrollTo instance, removes the instance from the timeline, so is no longer there, that's why is not scrolling again. What you have to do is check if the particular instance is defined in the timeline. If it is, that means the ScrollTo instance still exists so there is no problem. If the instance doesn't exists means that you have to add it again to the timeline and restart it. Something like this: See the Pen XWYyXWr by GreenSock (@GreenSock) on CodePen Hopefully this is enough to get you started. Let us know if you have more questions. Happy Tweening! 1 Link to comment Share on other sites More sharing options...
B_wu Posted December 5, 2022 Author Share Posted December 5, 2022 Hi @Rodrigo Thanks so much for this. Worked perfectly. Also thanks for making more sense of the auto kill feature. Much appreciated! 2 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