constbgCol="#447abd";constgCol="#a2c2e8";constnGrid=20;letw;letgSpace;functionsetup(){w=max(400,min(windowWidth,windowHeight)*0.9);gSpace=(w/nGrid)*0.95;describe("perfect squares move around in a bluprint design with a low opacity white.");createCanvas(w,w);rectMode(CENTER);d=w;angleMode(DEGREES);textSize(16);}functiondraw(){background(bgCol);translate(w/2,w/2);drawGrid();t=frameCount/3;stroke(255);strokeWeight(2);fill(255,255,255,20);for(leti=12;i>0;i-=1){if(i%2===0){rect(-11*gSpace+(0.5+i)*gSpace+abs(2*gSpace*sin(t+i*20)),+abs(2*gSpace*cos(t+i*20)),i*gSpace);}else{rect(10.5*gSpace-(0.5+i)*gSpace-+abs(2*gSpace*sin(t+i*20)),-+abs(2*gSpace*cos(t+i*20)),i*gSpace);}}noStroke();fill(gCol);text("perfect",-w/2+10,w/2-5);}functiondrawGrid(){stroke(gCol);strokeWeight(0.3);for(leti=1;i<=nGrid;i++){for(letj=1;j<=nGrid;j++){line(-w/2+gSpace*i,-w/2+gSpace,-w/2+gSpace*i,w/2-gSpace);line(-w/2+gSpace,-w/2+gSpace*i,w/2-gSpace,-w/2+gSpace*i);}}noFill();strokeWeight(3);rect(0,0,w-2*gSpace);}functionmousePressed(){setup();draw();}functionwindowResized(){setup();draw();}