xxxxxxxxxx
31
let x;
let y;
let xSpeed;
let xDirection;
let ySpeed;
let yDirection;
function setup() {
createCanvas(400, 400);
x=width/2;
y= height/2;
//play with these values to adjust speed and directon
xSpeed= 1;
xDirection= 1
ySpeed= 1;
yDirection= 1
}
function draw() {
background(220);
fill("turquoise");
ellipse(x, y, 50, 50);
x= x + xSpeed * xDirection;
y= y + ySpeed * yDirection;
}