onKeyDown(key: Key | Key[], action: (key: Key)=>void): KEventController
Register an event that runs every frame when a key is held down.
param
key- The key(s) to listen for.
param
action- The function to run when the event is triggered.
// move left by SPEED pixels per frame every frame when left arrow key is being held down onKeyDown("left", () => { bean.move(-SPEED, 0) });
returns
The event controller.
since
v2000.1