KeyPressLearn Op
Triggers when certain key is pressed or released
Summary (oneliner)
Can be used to trigger on a certain key press. Press the Learn
button and then press a certain key – you should see the Key Code
value change.
Once the op has learned a certain key it will trigger on the On Press
port once the key is pressed.
You can also decide weather or not key events in the whole document or only inside the canvas should trigger by setting the Canvas Only
checkbox.
Please note, that the key values of KeyPressLearn differ from the Ops.Devices.Keyboard.KeyPress op.
Here you will find a table listing all keys and there key codes: Javascript Key Codes
- Ops.Devices.Keyboard.KeyPressLearn
- Core Op - Official cables op
- MIT
Documentation (markdown)
Issues
Example patch id
Youtube ids (comma seperated)
Op Licence
Caniuse query
Example Patch KeyPressLearn Example
INPUT PORTS
In most cases you won’t have to use this directly, just use the Learn
button. It contains the key code on which to respond. You can use keycode.info to find out the key code you are looking for.
If you want to only trigger when a key has been pressed while the canvas has the focus (when you clicked in the canvas before) use true
. If you want key presses to trigger even if the canvas is not in focus set it to false
(global mode).
Prevent that other key listeners (parents) are informed on the key press
Press learn and directly afterwards (3 Seconds) press a key, this one will from now on trigger on the output port On Press
once the key has been pressed.
OUTPUT PORTS
Triggers every time the learned key is pressed down (and also triggers while it is hold down).
Triggers every time the learned key is released (once).
True if the key is currently pressed, false otherwise