Jump to content
Search Community

Repeat moving to X and back to original position

Aamir Khan test
Moderator Tag

Recommended Posts

I am moving a svg object from x position to  y position on click on a button using gsap. I want when I click again on the button, that svg object should come to original x positon and move again to y position. I mean I want to repeat the animation only when I click on a button, how can I achive this feature. Please help.

Link to comment
Share on other sites

Hi @Aamir Khan it is best to create your own topic, so I've moved your question. 

 

The easiest way to do that is creating a named tween and then calling .play() and .reverse() on it. If you can provide a minimal demo with your current setup we'll be happy to take a look for you. 

 

Also check out these getting started guides, there is so much useful information in there that I encourage you to take a look at! 

 

https://greensock.com/get-started/
https://greensock.com/get-started-2

 

Hope it helps and happy tweening! 

  • 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...