Jump to content
Search Community

Timeline: How to tweenTo within a number of seconds?

acidking test
Moderator Tag

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

For example I would like to tweenTo a label "3rd",  but it seems to play the rest of animation in sequence, which takes about 10 seconds, but I would like it to tweenTo that label within a shorter timeframe such as 2 seconds. How do I set that speed so that it overrides the rest of the animation? WITHOUT setting the timeScale, which I already tried.

var myAnim = new TimelineMax();
myAnim.to('.SomeClass', 5, {right:'10%'}, "1st")
.to('.SomeClass', 5, {right:'20%'}, "2nd")
.to('.SomeClass', 5, {width: '30%'}, "3rd");

myAnim.tweenTo("3rd");
Link to comment
Share on other sites

What version of GSAP are you using, acidking? jamie's code should work fine in recent versions. 

 

Or you could do it manually like this (a bit more code):

myAnim.pause();
TweenLite.to(myAnim, 2, {time:myAnim.getLabelTime("3rd"), ease:Linear.easeNone});

I suspect you're just using an outdated version of GSAP, though. http://www.greensock.com/?download=GSAP-JS

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