Xenex122 Posted June 13, 2022 Share Posted June 13, 2022 I want to reversed the animation but more faster than usual. const tl = gsap.timeline() And let say we .add() some animation on it when a duration of atleast 1 or 2 but when I click the button to reverse it will make the duration to 0.5 or 1/2 when I'm reversing the animation. Anyone can help me through this? See the Pen gOvZmMg by myth-vince (@myth-vince) on CodePen Link to comment Share on other sites More sharing options...
GreenSock Posted June 13, 2022 Share Posted June 13, 2022 Sure, you could greatly simplify things: See the Pen gOvZmxW?editors=0010 by GreenSock (@GreenSock) on CodePen Your "anim" variable was IDENTICAL to your "tl" variable ( tl.add() returns itself for easy chaining), so it doesn't make sense to tl.add(anim...). That's like trying to put the timeline inside of itself Does that clear things up? 1 Link to comment Share on other sites More sharing options...
Xenex122 Posted June 13, 2022 Author Share Posted June 13, 2022 Oh i have another question have about reversing it without animation?? like make all the animation duration to 0. Link to comment Share on other sites More sharing options...
GreenSock Posted June 13, 2022 Share Posted June 13, 2022 You mean jump back to the start? Sure, that's easy: tl.progress(0) Or you can pause it there: tl.pause(0); There are other options too, but I don't want to overwhelm you. I'd encourage you to read the docs. All animations have a bunch of control methods that let you do almost anything. 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