float t;
float theta;
int maxFrameCount = 150;
int a = 77;
void setup() {
//fullScreen(P2D);
size(600,600);
noFill();
}
void draw() {
background(55,50,80);
pushMatrix();
translate(width/2, height/2);
t = (float)frameCount/maxFrameCount;
theta = TWO_PI*t;
for (float x = -600; x <= 600; x += 100){
for (float y = -400; y <= 400; y += 100) {
float offSet = (x+y)*a;
float sz1 = map(sin(-theta+offSet), 0, 1, 0, 50);
float sz2 = map(cos(-theta+offSet), 0, 1, -25, 0);
strokeWeight(3);
stroke(255,100,100);
shape(x, y, sz1, sz2);
}
}
popMatrix();
}
void shape(float xPos, float yPos, float pOne, float pTwo) {
pushMatrix();
translate(xPos, yPos);
beginShape();
vertex(-pOne, -pOne);
vertex(-pOne, -pTwo);
vertex(pOne, -pTwo);
vertex(pOne, -pOne);
vertex(pTwo, -pOne);
vertex(pTwo, pOne);
vertex(pOne, pOne);
vertex(pOne, pTwo);
vertex(-pOne, pTwo);
vertex(-pOne, pOne);
vertex(-pTwo, pOne);
vertex(-pTwo, -pOne);
endShape(CLOSE);
popMatrix();
}