Mode:
Duration:
1
2
3
4
5
6
7
8
9
10
11
12
13
let x = 200, y = 100;
let xspeed = 3, yspeed = 2;
function setup() {
createCanvas(400, 200);
}
function draw() {
background(255);
x += xspeed;
y += yspeed;
if(x > width || x < 0) xspeed *= -1;
if(y > height || y < 0) yspeed *= -1;
ellipse(x, y, 50, 50);
}Coding works best on desktop or with an external keyboard.