Does anyone know if there’s a list of system variables somewhere in the p5 docs? I found this page in the docs that goes over mouseX
and mouseY
, but the AI overview from a quick Google search also pulls up a ton of others that I’m not seeing listed out:
-
mouseX
: Current horizontal location of the mouse pointer. -
mouseY
: Current vertical location of the mouse pointer. -
pmouseX
: Previous horizontal location of the mouse pointer (from the last frame). -
pmouseY
: Previous vertical location of the mouse pointer (from the last frame). -
mouseIsPressed
: A boolean value that istrue
when a mouse button is pressed andfalse
otherwise. -
Keyboard-related:
key
: The character of the last key pressed.keyCode
: The numeric Unicode value of the last key pressed, especially useful for special keys like arrow keys or Enter.keyIsPressed
: A boolean value that istrue
when any key is pressed andfalse
otherwise.
-
Canvas and Window dimensions:
width
: The width of the drawing canvas.height
: The height of the drawing canvas.windowWidth
: The width of the browser window.windowHeight
: The height of the browser window.
-
Other:
frameCount
: The number of frames that have been drawn since the sketch started.focused
: A boolean value indicating whether the sketch canvas currently has input focus.drawingContext
: Provides direct access to the underlying HTML5 CanvasRenderingContext2D object for advanced drawing operations not directly available in p5.js.