xxxxxxxxxx
20
let x;
let y;
let speed;
function setup() {
createCanvas(400, 400);
speed = 1;
x = width / 2;
y = height / 2;
}
function draw() {
background(220);
circle(x, y, 30);
if (x < mouseX) x += speed;
if (x > mouseX) x -= speed;
if (y < mouseY) y += speed;
if (y > mouseY) y -= speed;
}