Jump to content
Search Community

Timeline: How to tweenTo within a number of seconds?

acidking
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

Posted

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");
jamiejefferson
Posted

Does this work?
 

myAnim.tweenTo("3rd").duration(2);
  • Like 2
Posted

Nope didn't work, no effect at all.

What I am trying to achive is simply play from wherever it is, to the new target label within a set amount of seconds regardless of what happens within the timeline.

Posted

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

Posted

How recent? I am using 1.11.0

Posted

Hello acidking .. If you click Jacks last link .. you will see that GSAP is at 1.11.4

<script src="http://cdnjs.cloudflare.com/ajax/libs/gsap/1.11.4/TweenMax.min.js"></script>

:)

Posted

Actually the latest version is available to download here in the page, your club member area, CDN likns and github repository.

 

Rodrigo.

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