nick34992
4/20/2016 - 3:15 AM

Click Change Background. Using p5.js library.

Click Change Background. Using p5.js library.

var bgcolor;

function setup () {
  createCanvas(1024, 576);
  bgcolor = color(200);
  createButton("Change Background");
}

function mousePressed () {
  bgcolor = color(random(0, 170), random(0, 170), random(0, 170));
}

function draw () {
  background(bgcolor);
  fill(255, 0, 0);
  rect(200, 200, 200, 200);
  fill(255);
  textSize(60);
  text('Click on background of canvas.', 100, 100);
}