let r = 20
function setup() {
createCanvas(400, 400);
strokeWeight(4);
stroke(5)
}
function draw() {
background(255,255,255,15);
for(let j=0;j<width/r;j++){
for(let i=0;i<width/r;i++){
fill(255, 225, 0,80)
polygon(i*2*r+i*r +20*sin(frameCount/100),j*35 +20*sin(frameCount/100),r+10*sin(frameCount/100),6)
polygon(i*2*r+i*r -20*sin(frameCount/100),j*35 -20*sin(frameCount/100),r+10*sin(frameCount/100),6)
push()
translate(30,j)
fill(255, 185, 30,80)
polygon(i*2*r+i*r-20*sin(frameCount/100),j*34+20*cos(frameCount/200),r+10*sin(frameCount/100),6)
polygon(i*2*r+i*r+20*sin(frameCount/100),j*34-20*cos(frameCount/200),r+10*sin(frameCount/100),6)
pop()
}
}
fill(0,0,0,50)
}
function polygon(x, y, radius, npoints) {
let angle = TWO_PI / npoints;
beginShape();
for (let a = 0; a < TWO_PI; a += angle) {
let sx = x + cos(a) * radius;
let sy = y + sin(a) * radius;
vertex(sx, sy);
}
endShape(CLOSE);
}