Name | key |
||
---|---|---|---|
Examples | // Click on the window to give it focus // and press the 'B' key void draw() { if(keyPressed) { if (key == 'b' || key == 'B') { fill(0); } } else { fill(255); } rect(25, 25, 50, 50); } |
||
Description | The system variable key always contains the value of the most recently pressed key on the keyboard. For detecting the arrow keys, the keyCode variable is set to either UP, DOWN, LEFT, or RIGHT. | ||
Syntax | key |
||
Parameters | |||
Usage | Web & Application | ||
Related |
keyCode keyPressed keyPressed() keyReleased() |