Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
neeh

Repeat animation infinitely with a TimelineMax including a pause

Recommended Posts

Hi there,

 

I'm trying to make an animation to repeat infinitely with a TimelineMax instance that includes a pause.

 

var tl = new TimelineMax({ repeat: -1 })
  .to(repeatWithPause, 0.5, { rotation: 180 })
  .to(repeatWithPause, 0.5, { rotation: 0 })
  .addPause(1.0);

 

You can see in the codepen what I've tried so far. It seems I'm able to repeat several times the first animation. But as soon as I add a pause in the timeline, only the first iteration is played. The same applies for repeat > 1 and when the addPause() isn't at the end of the timeline.

 

I might be doing something wrong.

 

Any help appreciated.

See the Pen qXVXLY by hekat (@hekat) on CodePen

Edited by neeh
typo + grammar

Share this post


Link to post
Share on other sites

Hi @neeh :)

 

Welcome to the forum.

 

If you'd like to infinitely repeat a timeline, but have a pause between repeats, you just need to add a repeatDelay. Like this:

 

var tl = new TimelineMax({ repeat: -1, repeatDelay: 1 })

 

Hopefully that helps. Happy tweening.

:)

  • Like 6

Share this post


Link to post
Share on other sites

Thank you Craig for this quick answer!

 

It works!

 

Strangely, the code I had use to work on a project using 1.19.1. The problem appeared as I updated to 1.20.2

 

Thanks again

  • Like 1

Share this post


Link to post
Share on other sites

Hi @hitesh sahu

 

Welcome to the GreenSock Forum.

 

What´s your question?

If you start with repeating indefinitely, using -1,

you could change this later to 3 times.

 

See the Pen RmBMYY by mikeK (@mikeK) on CodePen

 

Happy tweening ...

Mikel

 

 

  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.

×