Highlighted

Loop Animate CC timeline X times and stop

New Here ,
Jun 09, 2016

Copy link to clipboard

Copied

I'm trying to loop the timeline a few times and stop. All the help files I have found so far do not work. Anyone have any ideas?

TOPICS
How to

Views

12.4K

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Loop Animate CC timeline X times and stop

New Here ,
Jun 09, 2016

Copy link to clipboard

Copied

I'm trying to loop the timeline a few times and stop. All the help files I have found so far do not work. Anyone have any ideas?

TOPICS
How to

Views

12.4K

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Jun 09, 2016 0
Enthusiast ,
Jun 09, 2016

Copy link to clipboard

Copied

Another time, try to search forum

Put this code on last frame. This is sample for 3 loops.

if(!this.alreadyExecuted){

this.alreadyExecuted=true;

this.loopNum=1;

} else {

this.loopNum++;

if(this.loopNum==3){

this.stop();

}

}

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 09, 2016 2
Adobe Community Professional ,
Jun 09, 2016

Copy link to clipboard

Copied

You can do it in a lot less code than that:

  1. if (!this.looped) this.looped = 1
  2. if (this.looped++ > 3) this.stop(); 

Put the code wherever you want it to stop, set the 3 to the desired loops.

Strange how often this specific simple question comes up.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 09, 2016 1
Advocate ,
Jun 09, 2016

Copy link to clipboard

Copied

I mentioned this in another thread with the same subject but I'll add it here as well... that code is more concise but I would change it to:

if (!this.looped) this.looped = 1;

if (this.looped++ == 3) this.stop();

(== instead of >) so that it stops at exactly at a specific number of loops.  Your example loops 4 times instead of 3.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 09, 2016 1
Adobe Community Professional ,
Jun 09, 2016

Copy link to clipboard

Copied

And as I responded last time, that depends on whether you put the code at the beginning or end of the main timeline.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 09, 2016 0
Advocate ,
Jun 09, 2016

Copy link to clipboard

Copied

It doesn't really seem logical to put it at the beginning of the timeline.

Typically when you loop something, you would want to stop on the end frame with something interesting to look at, some kind of message, or a call to action; not go back to a blank beginning frame before the animation started.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 09, 2016 0
New Here ,
Feb 19, 2020

Copy link to clipboard

Copied

Does this work for HTML 5 export?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 19, 2020 0