xxxxxxxxxx
23
let cx = 0;
let cy = 0;
function setup() {
createCanvas(400, 400);
// start circle in center of screen
cx = width / 2;
cy = height / 2;
}
function draw() {
background(220);
// move x 1% of distance to mouse
cx += (mouseX - cx) * 0.01;
// move y 1% of distance to mouse
cy += (mouseY - cy) * 0.01;
circle(cx, cy, 20);
}