float t;
float theta;
int maxFrameCount = 200;
int a = 95;
void setup() {
size(800, 700, P2D);
noFill();
}
void draw() {
background(240,100,90);
pushMatrix();
translate(width/2, height/2);
t = (float)frameCount/maxFrameCount;
theta = TWO_PI*t;
for (float x = -300; x <= 300; x += 50){
for (float y = -300; y <= 300; y += 50) {
float offSet = (x+y)*a;
float sz1 = map(cos(-theta+offSet), 0, 1, 0, -25);
float sz2 = map(cos(-theta+offSet), 0, 1, -13, 0);
strokeWeight(3);
stroke(245,225,125);
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();
}