O individuals who are more knowledgeable than me, I kindly ask the explanation of the code bellow, specifically how the movement is achieved.
let x = 100;
let y = 200;
let circleSpeedX = 3;
let circleSpeedY = 3;
function setup() {
createCanvas(400, 400);
}
function draw() {
background(0);
stroke(255);
strokeWeight(4);
noFill();
ellipse(x, y, 100, 100);
if (x > width - 50) {
circleSpeedX = -3;
circleSpeedY = random(-3, 3);
} else if (x < 50) {
circleSpeedX = 3;
circleSpeedY = random(-3, 3);
}
if (y > height - 50) {
circleSpeedY = -3;
circleSpeedX = random(-3, 3);
} else if (y < 50) {
circleSpeedY = 3
circleSpeedX = random(-3, 3);
}
x = x + circleSpeedX;
y = y + circleSpeedY;
}