Jump to next/prev keyframe


(Stefan Kraiss) #1

Hey,
I am currently working on a project were I would need a way to jump to the next or the previous keyframe of a specific timeline.
The reason is: I want to have a way to skip an animation. One reason is for a skip button so the user can skip the animation and go forward to the next keyframe in that timeline and the other usecase would be clicking a “back” button to go back but without going through the last animation. Can be javascript of course. Open for any option.

Is there any way to do that?
Thanks for the help!


#2

It’s not for “keyframes” but there is a method in the Hype API that can jump to specific times.

//hypeDocument.gotoTimeInTimelineNamed(time, timeline);
hypeDocument.gotoTimeInTimelineNamed(2, 'myTimeline');

(Layne Johnston) #3

Could you just use the “Go To Time in Timeline” command and insert the time on the timeline that your next keyframe resides?


(Stefan Kraiss) #4

I know that I can jump to any time in the timeline. The problem is, that I have a timeline with various keyframes and I would like to jump to the next keyframe while an animation is playing and the user wants to skip it. So I would need to find out at what time the next/prev keyframe is. Dynamically.


#5

There isn’t anything that logs the keyframes that you create and where (in a time sense) that they are which is built in to Hype. I believe they has been some requests to add something like this so you could create a feature request for this to add your use case and a +1 for the feature.

You could use some coding in the meantime to record where those keyframes are (time wise) and then if a user passes one you can record that and then you would know that they are in between 2 specific keyframes and based on what they press they can “skip” forward or “skip” back. If the timeline continues then you can update which keyframe they’ve passed and listen again. That’s the logic I would use in the meantime.


(Stefan Kraiss) #6

Hm okay… I already feared that this is not possible in the meantime. So you would suggest something like manually creating an array with keyframe times and then check for the position with that data. Or is there any other way you would suggest instead of manually creating that array?