Static p5_sys::global::resizeCanvas[][src]

pub static resizeCanvas: ResizeCanvasInternalType
Expand description

Resizes the canvas to given width and height. The canvas will be cleared and draw will be called immediately, allowing the sketch to re-render itself in the resized canvas.

Examples

function setup() {
  createCanvas(windowWidth, windowHeight);
}

function draw() {
  background(0, 100, 200);
}

function windowResized() {
  resizeCanvas(windowWidth, windowHeight);
}

Parameters

w width of the canvas

h height of the canvas

noRedraw? don’t redraw the canvas immediately