xxxxxxxxxx
23
let posX = 200;
let posY = 200;
function setup() {
createCanvas(400, 400);
fill(255,0,0);
}
function draw() {
background(220);
circle(posX, posY, 100);
// random function goes between 0 and 1
posX = posX;
posY = posY + 1 ;
if(posX > width) { posX = 0; } // left wall
if(posX < 0) { posX = width; } // right wall
if(posY < 0) { posY = height;} // top wall
if(posY > height) { posY = 0; fill(0,0,255); } // bottom wall
}