Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
m4g1c14n

Can not pause a tweenFromTo

Recommended Posts

Damn... i have just found the solution myself... I must store the tweenFromTo reference, and pause the reference instead .... 

Sorry , can this post be deleted now? ^^;

Link to post
Share on other sites

Sorry I'm late to the party, but glad you found the answer.

 

Yes, when using tweenFromTo() the timeline is technically paused and you are creating an external tween that is changing the time() property of the timeline. 

So you need to pause the tweenFromTo tween.. not the timeline.

  • Like 2
Link to post
Share on other sites

I have a question regarding this topic.

 

What if I had a codepen pretty similar to this, except with more labels:

See the Pen NqJQaX?editors=001 by ccelestine (@ccelestine) on CodePen

 

Is it possible to tweenFromTo("STEP 1", "STEP3") , 

but skip STEP2?

Link to post
Share on other sites

Hi Cyril,

 

It's been a long time!!

 

As far as I know I believe that this can't be done with just one instance, because basically you're going from the time of the first label to the time of the second label, then from the time of the third label to the time of the final label.

1 ---- 2 ---- 3 ---- END
1 ---- 2 skip 3 ---- END

What you could try is get the labels array and create a timeline that first takes the time property of the one you're scrubbing, from the time of the first label, to the time of the second and then from the third to the final. Also since the array returns the labels' names and times you can set the duration of each instance.

// get the labels array
// get the timeline duration between each label
var labelsArr = tl.getLabelsArray(),
    timeStage1 = labelsArr[1].time - labelsArr[0].time,
    timeStage2 = labelsArr[3].time - labelsArr[2].time;

$("#restart").click(function(){
  
  new TimelineLite()
    .fromTo(tl, timeStage1, {time:labelsArr[0].time}, {time:labelsArr[1].time})
    .fromTo(tl, timeStage2, {time:labelsArr[2].time},{time:labelsArr[3].time});
  
});

See the Pen zGbgQY by rhernando (@rhernando) on CodePen

  • Like 4
Link to post
Share on other sites

Rodrigo,

 

Sorry for the delay.

Thanks for this, pretty awesome!

I'll try to implement, and show you how it worked out once this project goes live!

Link to post
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.

×