xxxxxxxxxx
let ball = [];
function setup() {
createCanvas(windowWidth, windowHeight);
fill("#FFFFFF");
for (let i = 0; i < 100; i++) {
let balll = {
x: random(0, width),
y: random(0, height),
vx: random(-2, 2),
vy: random(-2, 2)
}
ball.push(balll)
}
}
function draw() {
background("#000000");
for (let j = 0; j < ball.length; j++) {
let b0ll = ball[j];
b0ll.x += b0ll.vx
b0ll.y += b0ll.vy
if (b0ll.x > width) {
b0ll.x = 0
}
if (b0ll.x < 0) {
b0ll.x = width
}
if (b0ll.y > height) {
b0ll.y = 0
}
if (b0ll.y < 0) {
b0ll.y = height
}
ellipse(b0ll.x, b0ll.y, 20, 20)
}
}