The old code for my shape!
void setup(){
size(500,500);
background(255);
}
void draw(){
rect(160,160,160,160);
rect(80,80,80,80);
rect(320,80,80,80);
rect(320,320,80,80);
rect(80,320,80,80);
rect(40,40,40,40);
rect(400,40,40,40);
rect(400,400,40,40);
rect(40,400,40,40);
rect(200,80,80,80);
rect(200,320,80,80);
rect(320,200,80,80);
rect(80,200,80,80);
}
The new code for my shape!
int x = 30;
int y = 30;
int w1 =40;
int a = 20;
int b = 10;
int bw = b+w1+b;
void setup(){
size(500,500);
background(255);
}
void draw(){
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