Jump to content
Search Community

Can not pause a tweenFromTo

m4g1c14n test
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

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

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

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