ellipse(sx, sy, r, r);

function animate() updatePosition(); drawBall(); requestAnimationFrame(animate);

let stars = []; function setup() createCanvas(windowWidth, windowHeight); for (let i = 0; i < 800; i++) stars.push( x: random(-width, width), y: random(-height, height), z: random(width) );

let sx = map(star.x / star.z, 0, 1, 0, width); let sy = map(star.y / star.z, 0, 1, 0, height); let r = map(star.z, 0, width, 4, 0);

function updatePosition() x - radius <= 0) dx = -dx; if (y + radius >= height