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