xxxxxxxxxx
32
let ball;
function setup() {
createCanvas(600, 400);
r = random(255);
g = random(255);
b = random(255);
ball = new Ball()
}
function draw() {
ball.move()
ball.display()
ball.bounce()
}
function mousePressed() {
// Check if mouse is inside the circle
let d = dist(mouseX, mouseY, 360, 200);
if (d < 100) {
// Pick new random color values
r = random(255);
g = random(255);
b = random(255);
background((255-r), (255-b), (255-g))
}
}