xxxxxxxxxx
39
let circles = [];
function setup() {
createCanvas(600, 400);
for (i = 0; i < 6; i ++) {
let x = random(width);
let y = 0 - random(100);
let r = random(5, 50);
circles[i] = new circle(x, y, r);
}
}
function draw() {
background(23, 32, 42);
for (let i = 0; i < circles.length; i ++){
circles[i].move();
circles[i].show();
}
}
class circle {
constructor(x, y, r) {
this.x = x;
this.y = y;
this.r = r;
}
move() {
this.y += 1;
if (this.y > height+(this.r*2)) {
this.y = -(this.r*2);
}
}
show() {
stroke(random(255), random(255), random(255));
fill(255, 0, 80);
ellipse(this.x, this.y, (this.r * 2)+random(5));
}
}