Jump to content
Search Community

Why is the animation not reverse?

Masohas test
Moderator Tag

Recommended Posts

I noticed several problems: 

  1. You keep re-creating the entire timeline/animation on every click. The playhead starts at 0, so if you call .reverse() and make the playhead go in the backward direction, nothing will happen because the playhead is ALREADY at the very start. You should create the timeline outside that method and just reuse the same one consistently. 
  2. You set pause: true instead of paused: true on the timeline constructor
  3. You don't need to wrap things in css: {} anymore - that's a VERY old syntax from almost a decade ago :) you should update to the more modern syntax. See

Is this what you were looking for?: 

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

  • Like 1
  • Thanks 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...