Jump to content
Search Community

Delay on FirstRun Only

celli 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

I am trying to create a delay on a master timeline, which is comprised of about 20 GSAP timelines. But I really only want the delay to fire the first time it runs, so every other time the master timeline plays it would loop without the delay.

 

This codePen is not simplified, and there is a lot going on, so I am testing--but maybe you can still see the master timeline at the bottom of the JS to help with a delay that runs on the first-time the master timeline plays only.

See the Pen yNmGdo?editors=001 by celli (@celli) on CodePen

Link to comment
Share on other sites

I would initially pause the timeline and set it to repeat infinitely 

var masterTimeline = new TimelineLite( {paused: true, repeat: -1} );

Then, just use setTimeout to delay masterTimeline.play()

 

EDIT

 

I didn't notice it was a TimelineLite instance ... that will have to be a TimelineMax instance to use the repeat property.

var masterTimeline = new TimelineMax( {paused: true, repeat: -1} );
  • Like 1
Link to comment
Share on other sites

Hi celli  :)

 

pls provide Reduced/Simple Codepen demo as possible , and if you want to use TimelineLite pls try like this :

var tl = new TimelineLite({ delay:3 , onComplete:function(){ this.restart() } });

or

var tl= new TimelineLite({ onComplete:function(){ this.restart() } , paused:true });

TweenLite.delayedCall( 3, function(){ tl.play() } );
 
  • 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...