Jump to content

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

Reverse Current & Play other Timeline on Click

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

Hello GSAPers,
I  need a very important help.
I'd like to know the best way to make alternate transitions between Timelines. Example: I click on the Go Red button to run the red timeline, and when I click on the Go Yellow button it will reverse the current timeline and start the required timeline.

Is there a way to do this only with one Timeline?

See the Pen zzdJGY by Noturnoo (@Noturnoo) on CodePen

Link to comment
Share on other sites

Please see this post:


  • Like 1
Link to comment
Share on other sites

1 hour ago, Carl said:

Por favor, veja esta publicação:


Thanks @Carl

I'll take a look and try to implement in my code. As soon as I have a progress, I come back to show

Link to comment
Share on other sites



It worked Carl,

Now I would like to know how to mute, instead of giving a reverse, it executes a tween to exit and then run the timeline of the button clicked


See the Pen zzdJGY by Noturnoo (@Noturnoo) on CodePen


Link to comment
Share on other sites

Hi @Noturnoo,


What do you mean by 'how to mute'? I am afraid your last question is a bit confusing. Could you re-phrase it?



Link to comment
Share on other sites




Sorry, I was using the translator, I'm Brazilian.
I already managed to do what I wanted, in my case it was to have an animation of entrance and to have another animation of exit.
Now I would like to have a way for the timeline to reverse through all the tweens and stop at the required action.
Example: https://www.reed.be/



Ai click on one of the names, it does a reverse but for the timeline at the exact point

Link to comment
Share on other sites

Don't worry about the language bits... We all struggle and not everyone's a native english speaker.


If you want to control all animations together, you might want to look into exportRoot() that will wrap everything into a single timeline that you can control separately.


See if that helps you.

  • Like 1
Link to comment
Share on other sites

Heloo, @Dipscom

Thank you for understanding about the rs language.
Very cool exportRoot (),

I just could not understand how I can implement this. Do you have any simple examples of this working? Because I only found this example and found it to be very advanced. hahaha

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


Link to comment
Share on other sites

Yeah, that is a lovely demo but it is also quite complicated one. I often find myself struggling with such demos that are super nice to look at but very hard to see the all the parts that make it move.


Right now I can't make a simpler example for you - I should and I shall at some point. But I have been thinking what you are intending to achieve and it occurred to me that what you want is a Carousel. Isn't it?


You want several items to be displayed in order and sequentially, moving automatically. Then, you want a control where if you click, it will display the relevant item. That's a Carousel.


If you search the forums here, there are several topics discussing it. Do forgive me for not being able to do more than that. I don't have a working carousel to show you. I know it will be hard but 'it is better to learn how to fish than to be given a fish'. 


When you find something that fits the bill to what you are after, come ask any questions here. Me and many others will be more than happy to help and explain things in more detail.


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