Jump to content
Search Community


mikel 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

Hm, interesting scenario. Never came across that need before. Well, this isn't "official" or anything, but it'll work:


function getPauses(tl) {
  var pauses = [],
      a = tl.getChildren(true, true, false),
  for (i = 0; i < a.length; i++) {
    if (a[i].data === "isPause") {
  return pauses;


Just feed in your timeline and it'll spit back all the pauses. So you can check the startTime() of any of them, and kill() whatever you want to (or whatever). 


You could structure things a bit differently, like instead of using one long timeline with a pause inbetween each animation, you could have an array of tweens and just keep track of the index of the current one you're playing, incrementing/decrementing that in an onComplete/onReverseComplete. Then, if/when you want to string them all together (with no pauses), you could drop them into a timeline that has autoRemoveChildren:true. Should be easy with add(). Just an idea - your way isn't "wrong" or anything. 


Happy tweening!

  • Like 4
Link to comment
Share on other sites

Hi @GreenSock Jack,

'To pause or not to pause' this is a good question.


Since I have to work hard for line after line at JS, I get along better with this solution - pause and label become easier for me.

But I will learn piece by piece.


Unfortunately I'm not clear with your code snippet - no spit:


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


Kind regards



P.S .: Please look at the CodePen in the DOCS addLabel.
It does not seem to be okay.


Since I put the label in the same place, I can use .GetLabelArray(). Year!



Edited by mikel
Heureka ...
Link to comment
Share on other sites

Hi Mikel,


Thanks for pointing out the error with the demo in the docs for addLabel(). I fixed it.




Glad to see that getLabelArray() is working for you.

Although it is fine to use addPause() as you are. You might want to look into TimelineMax.tweenTo()  and TimelineMax.tweenFromTo(), they let you tween the progress of a TimelineMax between any time or labels so you can do stuff like:

charly.tweenTo("label2"); // tween to "label2" from current position

charly.tweenFromTo("label1", "label2"); // tween from "label1" to "label2"


furthermore you can use dynamic values like




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