Using Keyboard Keys instead of a mouse click to run a timeline

Hi All,

I'm not a coder, but from other posts, I feel what i'd like to be done, can be done.

I have 6 buttons on a scene. Each button activates a different timeline in the scene.
each timeline has a mid-way Timeline Action (Pause Timeline) where when I hit another button we then Continue Timeline.

Rather than having a cursor or pointer moving around the screen, i'd love all these actions to be key hits. In other words, I press "1" and that activates timeline 1. After it pauses, I hit forward arrow to continue timeline. I do this for each button.... so pressing 2 starts timeline 2, and so on.

I'd also like to hit a key to jump to the next scene, and another key to go back to the previous scene.

can someone point me in the right direction (step-by-step) not only on what code I need but how to enter it and where?

Thanks so much!

:rotating_light: Please note that we can only address JavaScript questions and issues in the context of Tumult Hype, so please attach a Hype document so others can dig into what you have so far.

Here are some pieces you can plug together. It can help you to learn...

The navigating template has support for using the left and right keys.

The "Controlling" template also covers using keys, to move an element with the Physics API...

If you need to know the values of the keys, there's the "KEEN" app, as "keyCodes" can still work, but it's deprecated. So, KEEN shows the modern alternative values. (Heh, hard to see the "space" though.)

This is just general information. That's why I wrote "A Book About Hype". It's meant to be a linear guide to learning Hype. It might not be an exact match to what you're trying to do, but that's why it was written to have lots of mini lessons. That way you can use the parts to build more complex projects.

1 Like

This should work somehow: key 'n' leads you to the next scene, key 'p' to the previous scene. You can either start the timelines by pressing a button or a key - 'forward key' to continue the active timeline works in both cases.

Update: Keys limited to 1-6

Hope, this helps, Kalle (35.5 KB)