Jump to content

Search In
  • More options...
Find results that contain...
Find results in...

GSAP animation works only first time

Recommended Posts

Hello I'm new to GSAP animation. I add animation with jQuery it's working for the first time if you click on the " Green button " in the top right corner. I need to make the animation reverse also but when it's complete animation does not work second time. Please help Thanks.

See the Pen poEabBx by henrymanektech (@henrymanektech) on CodePen

Link to comment
Share on other sites

Hey Jay and welcome to the GreenSock forums. 


You're making a lot of the most common GSAP mistakes. I highly recommend giving it a thorough read :) 


What you should do instead is create your timeline outside of your event listeners and then just use control methods inside of the event listeners like so:

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


Also your event listeners should not be nested within one another.

  • Thanks 1
Link to comment
Share on other sites

You also need to try connecting cssplugin. You can also use TweenMax instead of TweenLite, which already includes it. Maybe this solution will help you.

Link to comment
Share on other sites

@lahisir No, he's using GSAP 3. GSAP 3 has CSSPlugin baked into the core by default. There is no Lite/Max flavors of GSAP 3.

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