xxxxxxxxxx
31
let height = 30;
let speed = 0.02;
function setup() {
createCanvas(windowWidth, windowHeight);
}
function drawCircle(radius, opacity, circleW){
const nb = radius/2;
const angle = Math.PI*2 / nb;
fill(0, opacity);
for(let i = 0; i < nb; i++){
ellipse(width/2 + cos(angle*i) * radius, width/2 - sin(angle*i) * radius, circleW, circleW);
}
}
function draw() {
background(220, 220, 220, 100);
noStroke();
for(let i = 0; i < 40; i++){
height -= speed;
drawCircle(i*10, 100-i*3, height);
}
if(height < 15 || height > 30) speed = -speed;
}