Skip to content

Instantly share code, notes, and snippets.

@REAS
Created May 21, 2014 16:35
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save REAS/8f462dad07a1d6daa94f to your computer and use it in GitHub Desktop.
Save REAS/8f462dad07a1d6daa94f to your computer and use it in GitHub Desktop.
int gap = 20;
void setup() {
size(1000, 1000);
strokeWeight(4);
strokeCap(SQUARE);
frameRate(0.5);
}
void draw() {
background(204);
drawPattern(0);
drawPattern(random(TWO_PI));
}
void drawPattern(float angle) {
pushMatrix();
translate(width/2, height/2);
rotate(angle);
int rowCount = 0;
for (int y = -300; y <= 300; y += gap*2) {
for (int x = -300; x <= 300; x += gap) {
if (rowCount % 2 == 0) {
line(x, y, x, y + gap*2);
} else {
line(x+gap/2, y, x+gap/2, y + gap*2);
}
}
rowCount++;
}
popMatrix();
saveFrame();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment