hey Posted May 16 Share Posted May 16 I'm super new to GSAP and JavaScript in general. Trying to create a morphing logo for my website. Will take step by step. My first step is trying to figure out how to apply "elastic.out" to each yoyo iteration. Currently, the first iteration (which plays forwards) has "elastic.out" as intended, but the second iteration (which plays backwards) has "elastic.in", I guess because it's yoyo, which reverses everything. Is there a way to have "elastic.out" when playing forwards and backwards? Thanks. See the Pen WNBQMYW by alananal (@alananal) on CodePen Link to comment Share on other sites More sharing options...
mvaneijgen Posted May 16 Share Posted May 16 Hey, Hi, Hello, @hey welcome to the forum! 30 minutes ago, hey said: I guess because it's yoyo, which reverses everything. Correct! You have to view a tween as a movie and with reverse you'rre literally grabbing he playhead and dragging it backwards. But GSAP gots you covered, what you can do is manipulate the tween with another tween 🤯! I've changed your tween to a timeline not strictly necessary, but timelines are just so much more powerful. And then have a function with that calls a .tweenTo() (when you got some spare time it is a good idea just to give the docs a once over, you'll be surprised how much has already been thought of!) method on the timeline and tweens to a duration of 1 or back to 0, with the ease you want applied. Hope it helps and happy tweening! See the Pen dyEYmBr?editors=0010 by mvaneijgen (@mvaneijgen) on CodePen 3 Link to comment Share on other sites More sharing options...
hey Posted May 16 Author Share Posted May 16 Thank you for the reply. For some reason, the elastic animation is not as smooth as the original. I'm gonna play with it some more. Link to comment Share on other sites More sharing options...
Solution mvaneijgen Posted May 17 Solution Share Posted May 17 You're right, then maybe just calling a new tween each time you want to morph, this way it always plays 'forward'. Hope it helps and happy tweening! See the Pen QWRjzmO?editors=1011 by mvaneijgen (@mvaneijgen) on CodePen 4 Link to comment Share on other sites More sharing options...
hey Posted May 17 Author Share Posted May 17 Thank you, Mitchel! 👌 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