Jump to scene on keydown if timeInTimeLine is


(Markus Bjerre) #1

Hello! I’m currently trying to add some keydown scripts and I’m wondering if and how I can make the app go to a different scene if I press the button when the time is 1 second or 2 seconds.

To be more specific, the main scene has two buttons. I want to change the buttons border depending on what time in the timeline it is.

At 1 second, btn1 will be highlighted.
At 2 seconds, btn2 will be highlighted.

When I use for example “A” on the keyboard at 1 second in the timeline I want to jump to scene 1.
When I use “A” on the keyboard at 2 seconds in the timeline I want to jump to scene 2.

Any help is much appreciated.

I MANAGED TO FIX THIS WITH FOCUS IN CSS, HOWEVER THERE ARE SOME BUGS WITH SCENE TRANSITION AND KEYBINDS. LOOK AT MY OTHER COMMENTS


(strmiska) #2

there´s info about that:


(Markus Bjerre) #3

Well this is a little bit more tricky. I managed to solve it with focus in external css, however, binding the buttons does not work in one of the cases. I am not sure why, the jquery should trigger it properly but nothing happens.
Take a look:
click.hype.zip (48.0 KB)


(Markus Bjerre) #4

Also, if you add this to the code it will slow down the browser for each click.
It will make it click correctly but hangs up upon too many clicks.

 $home = $('.home');

$home.on('click', function () {
    hypeDocument.showSceneNamed('main');
});

I’m curious why it states that the scene name should be without citations when it clearly doesn’t work without them. @Daniel perhaps a fix in the docs? Also, would be cool if you take a look at my file and add the above code to it. You might not see any big delays after a couple of tries with the down arrow key but after around 20 tries it will add a huge delay to it.
EDIT:: Added the code in a new file to save you the time :slight_smile: click2.hype.zip (48.1 KB)