Your computer's keyboard provides a simple way to get input to your sketch. This can be helpful for switching on/off parts of your code, typing onscreen, moving objects with the arrow keys, etc. The downside, which we'll see in the next demo, is that the keyboard only gives us binary on/off input rather than the fluid, expressive (but less accurate) input from the mouse.
🖥 https://editor.p5js.org/jeffThompson/...
ALL THE VIDEOS IN THIS UNIT
🎥 • CP1: Week 07 (Interactivity)
SEE ALSO
💡 For more on ASCII: https://en.wikipedia.org/wiki/ASCII
CHALLENGES:
❓ Can you make a cheat-sheet with all the keyCodes for future reference?
❓ Can you have the square stop when it hits the edges of the screen?