Loop then stop early in the timeline


I need to loop an animation then stop at a position on the timeline (before the end of the timeline) after the 3rd loop.
I imagine that this could be done with javascript, but I know nearly nothing about it. Is there some simple code that I could add to make this happen?


This should get you most of the way there: Set number of loops

When the 3rd loop is detected, you would simply run this Hype JS function:

hypeDocument.pauseTimelineNamed('Main Timeline');

Or, you could trigger a timeline that does what you wish (pause a different timeline, or do something else). Here are more JS functions relating to Timelines.