Google News
logo
p5.js - Interview Questions
What is the createCanvas() Function?
The createCanvas() function creates an HTML canvas on the web page, taking the desired canvas width and height as arguments. Typically, it is one of the first functions called in the setup() function. The createCanvas() function can only be called once within a p5.js sketch.
function setup(){
  // Creates a canvas with 600px width and 400px height
  createCanvas(600, 400);
}​
Advertisement