Jump to content
Search Community

Reversing with TimelineMax

Anas7 test
Moderator Tag

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

Hey guys,

 

I am very new to GreenSock and I having some issues. I have a button that when you click, plays the animation. But is there a way to set up the JS that when you click the same button again, it reverses the animation? Thanks!

 

 

Link to comment
Share on other sites

Hi Anas7  :),

 

Welcome to the forums.

 

You can certainly reverse a timeline on click. I'm not sure how your code is currently set up, but here's a pen showing a menu icon playing and reversing on click:

See the Pen jWWdWb by PointC (@PointC) on CodePen

 

If you'd like specific answers about your project you can make a CodePen so everyone can see your code in action. This is the best way to get great answers from others. Here's how to make a pen:

http://greensock.com/forums/topic/9002-read-this-first-how-to-create-a-codepen-demo/

 

Hopefully that helps a bit. 

 

Happy tweening and welcome aboard. 

:)

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