pixelkind / p5canvas

An interactive preview for writing p5js code in Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=garrit.p5canvas
Other
39 stars 4 forks source link

Why background() is not working in setup()? #33

Closed hunar1997 closed 4 years ago

hunar1997 commented 4 years ago

I installed the extension, all the commands in draw() works, but if i place e.g background(255) in setup(), it doesn't affect the display, but when i open the html file with my browser it works as expected

function setup() {
  createCanvas(500, 400);
  background(255,0,0);
}
function draw(){
}
pixelkind commented 4 years ago

Hej @hunar1997, there is a standard setup script included which set up the canvas. In one of the next versions you can add your own setup routine. For now the setup method can not be overridden and can not be used as in plain html.