Random Squares by Bill Kolomyjec

Computer Graphics & Art TRIANGULATION BLOG 20myrandomsquares

Code:

size(700, 500);
int x = 0;
int y = 0;
for(int i = 0; i < 5; i++){
   for(int j = 0; j < 7; j++){
     rect(x, y, 100, 100);
     float limit = random(2, 10);
     for(int k = 0; k < limit; k++){
       float offset = k+5*k+5;
       float xTemp = x+offset;
       float yTemp = y+offset;
       float size = (limit-k)*10;
        rect(xTemp, yTemp, size, size);
        xTemp+=5;
        yTemp+=5;
     }
     x+=100;
   }
   x = 0;
   y+=100;
}

 

Leave a Reply