emilychews

Repeat Timeline from a Different Starting Point

Recommended Posts

Hi,

 

Is it possible to create a timeline that after playing for the first time, when it repeats it starts from a different point in the timeline?
 

In the example below (CodePen included) I'd like the timeline to play through once from the start, and then after this when the repeat kicks in I'd like it to start from the "start" label.  It will basically remove the initial fading in off all the elements after the first play.
 

  var tl1 = new TimelineMax({repeat: -1});

        tl1
        .to(".box", 2, {opacity: 1})
        .add("start")  	// would like animation to start from here when repeating
        .to("#box-1", 1, {scale: 0, ease:Power0.easeNone})
        .to("#box-2", 1, {scale: 0, ease:Power0.easeNone})
        .to("#box-3", 1, {scale: 0, ease:Power0.easeNone})
        .to("#box-4", 1, {scale: 0, ease:Power0.easeNone})
  
  

  


Many thanks
 

Share this post


Link to post
Share on other sites

Hi @emilychews :)

 

You could do something like this:

 var tl1 = new TimelineMax({onComplete:function(){tl1.play("start")}});

 

 

You could also make the fade tween a stand-alone tween and then onComplete play the main timeline. There are lots of possibilities.

 

Hopefully that helps. Happy tweening.

:)

 

  • Like 5
  • Thanks 1

Share this post


Link to post
Share on other sites

You're welcome. That's how we roll in the GreenSock neighborhood. 

 

Thank you for providing clear questions and simplified demos. It makes troubleshooting and answering questions so much easier and results in better answers for you and all the other community members. It's most appreciated. :)

 

Happy tweening.

 

  • Like 3

Share this post


Link to post
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.