Skip to content

Latest commit

 

History

History
20 lines (16 loc) · 552 Bytes

p5js-template.md

File metadata and controls

20 lines (16 loc) · 552 Bytes

Below is a skeleton of a typical p5.js sketch

// setup() executes only once and at the very beginning
// firstly create a full window canvas 
function setup() {
  createCanvas(windowWidth, windowHeight);
}

function draw() {
    // draw() executes over and over once setup() has executed
}

function windowResized() {
  // this function executes everytime the window size changes

  // set the sketch width and height to the windowWidth and windowHeight. This gets rid of the scroll bars.
  resizeCanvas(windowWidth, windowHeight);
}