Jump to content
Search Community

Button elastic animation

Karen test
Moderator Tag

Recommended Posts

@Karen, you can add timer after the mouse is clicked. And this timer will stop timeline animation whenever you want. For example, inside 'mousedown touchstart' event listener add setTimout after your tl.start() method, like this:

setTimeout(() => {
  tl.pause();
}, 400);

400 it is your animation timing, which is 0.4.

 

Also, I recommend you to replace tl.reverse() with a new morphSVG animation which will morph into the original state. Because a simple reverse looks  unnatural.

Link to comment
Share on other sites

Hey Karen and welcome to the forums! Thanks for being a Business Green member. We couldn't do what we do without people like you.

 

I would actually recommend using two separate tweens in this case, as Aleksei suggests. That way you have full control over the way each is easing. You could set it up like so:

See the Pen dyPXqOp?editors=0010 by GreenSock (@GreenSock) on CodePen

  • Like 1
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...