knitted lattice
@author
float step = 20;
float border = 10;
void setup(){
size(500, 500);
mousePressed();
}
void draw(){
}
void mousePressed(){
background(random(255), random(255), random(255));
color c1 = color(random(255), random(255), random(255));
color c2 = color(random(255), random(255), random(255));
noStroke();
for(int w = 0; w < width; w += step){
for(int h = 0; h < height; h += step){
if(random(1) < 0.5){
fill(c1);
rect(w, h + (step - border) / 2, step, border);
fill(c2);
rect(w + (step - border) / 2, h, border, step);
} else {
fill(c2);
rect(w + (step - border) / 2, h, border, step);
fill(c1);
rect(w, h + (step - border) / 2, step, border);
}
}
}
}