Jump to content


tweenTo in a fixed amount of time?

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

This fiddle:


is behaving ALMOST the way I'd like it to.


The only thing I'd like to change is to have the tweens all take the same amount of time.  When you move from the third position to the first position by clicking a button, or vice-versa, it takes twice as long as when moving from the first to the second position.


I found some answers to similar questions that involved changing the speed of the entire animation, but that would be unwieldy here because first I'd have to have logic to determine whether that was necessary, then increase the speed, then run the tweenTo, then decrease the speed.


Thoughts? Do I have to throw this out and start again?

Link to comment
Share on other sites

Ah no worries, nothing to throw away here! This is a really simple effect to handle - you can just replace the tweenTo (linear scrub of the timeline) with a tween of the timelines time to the desired time/label

// pause the timeline, and tween its time to a label with a set duration
TweenLite.to(tl.pause(), 1, { time: tl.getLabelTime("someLabel") });

// tweenTo() does the same thing, except its duration is modified to
// match the timeline's speed

I replaced all of your tweenTo's, but it makes more sense to only replace the one in your click handler... oh well.

  • Like 3
Link to comment
Share on other sites

Just the quick fix I was hoping for! :-P  Thanks m8!  (Use TweenLite to manipulate the timeline... so much yet to wrap my head around...)


And no, I like that you replaced all of the tweenTos, because in doing so you have also somehow ironed out some other timing issues with the automatic-advancing feature.



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.