Jump to content
Search Community

Resume a paused timeline from another timeline

phillip_vale test
Moderator Tag

Go to solution Solved by phillip_vale,

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

Hi,

 

I am trying to work out best practice to pause another play another timeline.

 

I have included 2 attempts with the first commented out.

 

Ideally i would like it to run so that in the sequence of the first timeline (tl1) it resumes the paused timeline (tl2).

 

I'm not sure if this means that an onComplete need to be added or whether it can just be a command in the timeline.

 

e.g.

 

.from("object", 1, {})...

.from("object", 1, {})...

.resume("tl2")

.from("object", 1, {})...

 

Sorry if the syntax is incorrect just trying to explain my problem.

 

Any help is appreciated.

 

Thank you,

 

Phil

See the Pen rLVMaB?editors=1010 by phillip_vale (@phillip_vale) on CodePen

Link to comment
Share on other sites

Amazing, Carl to the rescue again!

 

I guess i was wanting to have a mainTL with another timeline resting on pause that would play once the first 2 items in the mainTL have.

 

I have updated my codepen to this...

var mainTL = new TimelineMax()
mainTL
  .to("#moving", 1, {x: 100})
  .play("otherTL")
  
var otherTL = new TimelineMax({paused: true})
  otherTL
  .to("#move", 1, {x: 100})

I have heard about nested timelines in my reading. Does that sound like where i am going with this?

 

Thanks for you help again,

 

Phil

Link to comment
Share on other sites

Glad you found something that worked for you, although that's not a nested timeline. Here's what a nested timeline would look like:

var mainTL = new TimelineMax()
mainTL
  .to("#moving", 1, {x: 100})
  
var otherTL = new TimelineMax();
otherTL
  .to("#move", 1, {x: 100});

mainTL.add(otherTL); //<-- this is nesting

This solution will work great backwards and forwards whereas the way you did it wouldn't really give you a timeline that's completely controllable in any direction (seek, reverse, whatever). 

 

I'd highly recommend watching/reading these: 

http://greensock.com/sequence-video

http://greensock.com/position-parameter

 

Happy tweening!

  • Like 2
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...