xxxxxxxxxx
19
let buttonBackground;
function setup() {
createCanvas(windowWidth, windowHeight);
buttonBackground = createButton("Change Background");
buttonBackground.mousePressed(changeBackground);
}
function draw() {
let x = (frameCount / 4) % (width / 2);
let y = (frameCount / 4) % (height - 20);
buttonBackground.position(x, y);
}
function changeBackground() {
background(random(255), random(255), random(255));
}