Jump to content
Search Community

tweenTo duration ?

friendlygiraffe test
Moderator Tag

Recommended Posts

Absolutely. Here's the easy answer:

myTimeline.tweenTo("zoom1").duration(3); 

But just so you know, tweenTo() method is just a convenient way to tween the timeline's "time" value, so under the hood it is basically doing something like this:

//first pause the timeline so that it doesn't keep trying to update itself - our tween will drag the playhead
yourTimeline.pause();

//figure out the destination time (let's assume you passed in a label):
var time:Number = yourTimeline.getLabelTime(label); 

//figures out the duration automatically, assuming you want the timeline to play at normal speed linearly
var duration:Number = Math.abs(time - yourTimeline.time()); 

//now spit back the tween:
return TweenLite.to(yourTimeline, duration, {time:time, ease:Linear.easeNone});

So you're welcome to do that kind of thing yourself directly instead:

yourTimeline.pause();
TweenLite.to(yourTimeline, 3, {time:yourTimeline.getLabelTime("zoom1"), ease:Linear.easeNone});
  • Like 1
Link to comment
Share on other sites

Thanks a lot for your reply.

 

I didn't have any luck, using the last one. I get this error:

timeline.pause();
TweenMax.to(timeline, 2, {time:timeline.getLabelTime("zoom1"),ease:Quart.easeOut});

 

Error #1069: Property time not found on com.greensock.TimelineMax and there is no default value.

 

Link to comment
Share on other sites

Hi, sorry for the confusion. You can get the latest versions of v11 or v12 from that page. Take a look at the text under the word "important" up top. Hopefully that clears things up.

 

Chances are you went right for the AS3 button without reading... totally understandable. 

Link to comment
Share on other sites

  • 7 months later...

Apologies for bringing up an old topic, but just want to point out to anyone else who finds this thread that this syntax:

myTimeline.tweenTo("zoom1").duration(3);

Doesn't work - the tween continues at the previous duration, even though the duration property reports back the changed value. You have to manually do it as was posted above:

timeline.pause();
TweenMax.to(timeline, 2, {time:timeline.getLabelTime("zoom1"),ease:Quart.easeOut});
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...