Go to time and continue timeline

Gads! Why can’t I figure out something so simple! I just want to jump to a certain time on the main timeline and continue playing. When I jump it stops. Here is a simple example.

Thanks!

Update 1: I just saw that you also have a continue playback on the 00:02,00 mark. Seams, like it isn’t triggered. Even though your landing on it. Could be a bug.

Update 2: If you remove the pause and let the continue timeline action play in reverse and then click the square once published you can actually see it working.

Conclusion Hype doesn’t fire timeline actions even if it lands exactly on them if the play state is set to pause. Feels wrong, I must admit.

1 Like

(This is not a bug but Hype’s intended behavior: you must play the timeline to trigger timeline actions)

1 Like

Update: It's a feature not a bug. If this is intentional then just add continue timeline to your button instead of the timeline. If it should be a timeline action, make sure to invoke continue timeline before jumping, then your timeline actions fire (and then you would have to stop playing again if you only wanted the timeline action to trigger).

That realization should come in handy for the custom timeline scrubbing. I was always frustrated with missing actions support on that code snippet.
Update: Action stack calls are quantized when jumping (by input of a frame) and hence we can trigger the actions on a certain frame but the API is missing any kind of quantization. That's very unfortunate so the same can't be done with pure JavaScript. I managed to get it working by using the following (borrowing from the quantization calculation used in the runtime):

hypeDocument.goToTimeInTimelineNamedAndTriggerAction = function(timeInSeconds, timelineName){
	var seconds = Math.floor(timeInSeconds);
	var frames = Math.round(((timeInSeconds - seconds) * 30)) / 30;
    var direction = this.currentDirectionForTimelineNamed(timelineName);
	var playing = this.isPlayingTimelineNamed(timelineName);
	if (!playing) this.continueTimelineNamed(timelineName, direction , true);
	this.goToTimeInTimelineNamed(seconds + frames, timelineName);
	if (!playing) this.pauseTimelineNamed(timelineName);
}

2 Likes

Sorry, for spamming the thread with JavaScript related solutions to the topic request to be a GUI question. The solution for GUI was posted in the first paragraph of the previous post. But it might be useful in the future to talk about the API solution and I just remembered that there was a function from ages ago to convert a timeline string in different notations into seconds. Meaning you can even pass in the string you see in the GUI if that helps when making such calls in JavaScript:

var timeInSeconds = hypeDocument.timeIndexToSeconds('01:40,15');
hypeDocument.goToTimeInTimelineNamedAndTriggerAction(timeInSeconds, 'timelineName');

Thanks Max,

I will try this tomorrow morning! I wonder if I could have another timeline trigger the main timeline to continue playing?

Cheers,
Maurice