xxxxxxxxxx
24
// Graphics object
//
// Jared Donovan, 2022
//
// Demonstrates how to use a graphics object
// to have a changing background.
let g;
function setup() {
createCanvas(400, 400);
g = createGraphics(width, height);
}
function draw() {
background(frameCount % 255);
if (mouseIsPressed){
g.circle(mouseX, mouseY, 10);
}
image(g, 0, 0);
}