Environment

size()

p5.size(width, height)

Resize the sketch window.

Parameters:
  • width (int) – width of the sketch window.
  • height (int) – height of the sketch window.

title()

p5.title(new_title)

Set the title of the p5 window.

Parameters:new_title (str) – new title of the window.

pixel_density()

p5.pixel_density()

Returns the current pixel density

height, width

Global integers that store the current width and height of the sketch window.

frame_count

Global integer that keeps track of the current frame number of the sketch i.e., the number of frames that have been drawn since the sketch was started.

frame_rate

Global integer variable that keeps track of the current frame rate of the sketch. The frame rate can only be set when the sketch is run by passing in the optional frame_rate keyword argument to the run() function. See the run() function’s reference page for details.