Jump to content
GreenSock

m4g1c14n

Can not pause a tweenFromTo

Moderator Tag
Go to solution Solved by m4g1c14n,

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

  • Solution

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 comment
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 comment
Share on other sites

  • 4 weeks later...

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