Jump to content
Search Community

Loop nested timeline with Timeline Lite

jordank test
Moderator Tag

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

In the attached codepen I've got a child timeline that I'd like to loop X amount of times by using a function call. Then I'd like to continue playing through the rest of the timelines in the master timeline. I know this would be easy using Timeline Max but I'm trying to figure it out using just Timeline Lite.

 

In the function call I'm trying to replay the calling timeline by using this.restart but I'm not having any luck.

 

I've been poking at this for a while, trying different things with the .call scope, but without any luck. Anyone have any ideas? Thanks!

See the Pen OoMPXp?editors=0010 by jordank (@jordank) on CodePen

Link to comment
Share on other sites

You're welcome, @jordank :)

 

On another note ... it might be useful to seek to a label on the master timeline rather than restart ... in the event that you want to loop the middle portion of a master timeline. Defining a label within each master timeline add() and then passing that label as a 3rd parameter to looper would take care of that.

 

 

See the Pen VGeYgP by sgorneau (@sgorneau) on CodePen

 

  • Like 3
  • Thanks 1
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...