float ratio = 1.78125;
void setup() {
size(800, 800);
noStroke();
fill(0, 155, 250);
}
void draw() {
background(25);
float size = 64, yoff = size*ratio;
for (int x = 0; x <= width+size; x+=size*2)
for (float y = 0; y <= height+yoff; y+=yoff)
makeHex(new PVector(x+(((y % (yoff * 2)) == 0) ? size : 0), y), size);
}
void makeHex(PVector loc, float size) {
float offset = sin(radians(dist(loc.x, loc.y, width/2, height/2)-frameCount))*size/ratio;
beginShape();
for (int i = 0; i < 6; i++) vertex(loc.x+sin(PI*i/3) * (size/ratio-offset), loc.y+cos(PI*i/3) * (size/ratio-offset));
endShape(CLOSE);
}