Jump to content
GreenSock

Learning

Repeating Timeline play from current to x label in 1 secs

Go to solution Solved by PointC,

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

Hi guys,

 

A timeline question, if I have a repeating timeline that loops from label A to B to C (and of cos back to A), and I have a button to click to skip to any label.

 

How do I have an action that will continue playing the timeline just that it accelerates and scrub till the desired label?
 

So if we are currently at A, and you click C, it plays A to C in 1 second. Or if you are at B and you click A, it plays from B to C then back to A in 1 second?

Link to comment
Share on other sites

  • Solution

Hi Learning :)

 

If I understand your question correctly, you're looking for the tweenTo() method. I think something like this should work:

yourTimeline.tweenTo("yourLabel").duration(1);

More information about tweenTo() can be found in the docs:

 

https://greensock.com/docs/#/HTML5/GSAP/TimelineMax/tweenTo/

 

If that isn't what you meant, could you please provide a CodePen demo for us? Thanks.

 

Happy tweening.

:)

Link to comment
Share on other sites

Hi @PointC,

 

It is what I mean, but I tried using the script you suggested and the timeline just stops playing. Hmm...

Link to comment
Share on other sites

Hi PointC,

 

My bad, it was a wrong naming on my end. The script worked! Thank you so much~ =)

But one quick note, from C to A, it actually reverses the timeline passing through B instead of going through the loop from C to A directly.
Is there a way to overcome that?

Link to comment
Share on other sites

Sounds like you will need some extra logic to determine that you are on C and then you will have to tween somewhere else like the end of the timeline before jumping to A. That's the best we can do without seeing a reduced demo.

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