int xRepeat = 150;
int yRepeat = 150;
int x = 10;
int y = 10;
int w1 =40;
int a = 10;
int b = 10;
int bw = b+w1+b;
void setup() {
size(500, 500);
background(255);
for (int i = 0; i < width/xRepeat; i++) {
for (int j = 0; j < height/yRepeat; j++) {
pushMatrix();
translate(xRepeat*i, yRepeat*j);
myPattern();
popMatrix();
}
}
}
void myPattern() {
rect(x+a+w1,y+a+w1,bw,bw);
rect(x,y,a,a);
rect(x+a+w1+bw+w1,y,a,a);
rect(x,y+a+w1+bw+w1,a,a);
rect(x+a+w1+bw+w1,y+a+w1+bw+w1,a,a);
rect(x+a,y+a,w1,w1);
rect(x+a+w1+bw,y+a,w1,w1);
rect(x+a,y+a+w1+bw,w1,w1);
rect(x+a+w1+bw,y+a+w1+bw,w1,w1);
rect(x+a+w1+b,y+a,w1,w1);
rect(x+a,y+a+w1+b,w1,w1);
rect(x+a+w1+b,y+a+w1+bw,w1,w1);
rect(x+a+w1+bw,y+a+w1+b,w1,w1);
}
No comments:
Post a Comment