Prevent start and continue timeline actions from restarting the timeline


(stephen) #1

Currently Start and Continue actions will restart a timeline if you have played to the end of the timeline and fire a continue action again. If you do not want your timeline to start over if it is already at the end you can use a bit of javascript to prevent the timeline from restarting.

Instead of a Continue timeline action add the following Run Javascript action (fill in your timeline name):

var timelineName = 'Main Timeline';
if (hypeDocument.currentTimeInTimelineNamed(timelineName) != hypeDocument.durationForTimelineNamed(timelineName)) {
	hypeDocument.continueTimelineNamed(timelineName, hypeDocument.kDirectionForward);
}

And here is the function for reverse:

var timelineName = 'Main Timeline';
if (hypeDocument.currentTimeInTimelineNamed(timelineName) != 0) {
	hypeDocument.continueTimelineNamed(timelineName,hypeDocument.kDirectionReverse);
}