p5.js Events Complete Reference

The p5.js events used to provide a dynamic interface to a webpage. These events are hooked to elements in the Document Object Model(DOM).
|
Keyboard |
Description |
|---|---|
| keyIsPressed | It is true if any key is pressed and false if no keys are pressed. |
| key | It always contains the value of the key which is recently pressed. |
| keyCode | It always contains the key code of the key that is recently pressed. |
| keyPressed() | It is invoked whenever a key is pressed. |
| keyReleased() | It is invoked whenever a key is called every time when a key is pressed. |
| keyTyped() | It is invoked every time when a key is pressed, except for action keys. |
| keyIsDown() | It checks the key’s current status that key is down. |
|
Mouse |
Description |
|---|---|
| mouseMoved() | It is called every time the mouse moves. |
| mouseDragged() | It is used to check the mouse drags. |
| mousePressed() | It works when mouse clicked on the document. |
| mouseReleased() | It works when mouse button released. |
| mouseClicked() | It works when mouse button pressed and released. |
| doubleClicked() | It is invoked whenever a mouse causes a dblclick event. |
| mouseWheel() | It is invoked whenever a mouse causes a vertical mouse wheel event. |
|
Touch |
Description |
|---|---|
| touchStarted() | It is called once after every time a touch is registered. |
| touchEnded() | It is called when a touch ends. |
Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, zambiatek Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!



