Advertisement
xeromino

grid

Jan 21st, 2014
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. int step = 80;
  2.  
  3. void setup() {
  4.   size(800, 640);
  5.   background(255);
  6.   strokeCap(SQUARE);
  7.    
  8.   drawGrid();
  9.  
  10. }
  11.  
  12. void draw() {
  13. }
  14.  
  15. void mouseClicked() {
  16.   setup();
  17. }
  18.  
  19. void keyPressed() {
  20.   save(random(1234)+".png");
  21. }
  22.  
  23. void drawGrid() {
  24.  
  25.   for (int x=step; x<width; x += step) {
  26.     for (int y=step; y<height; y += step) {
  27.       noFill();
  28.       int c = 0;
  29.       strokeWeight(step/4);
  30.       for (int i=0; i<4; i++) {
  31.         float r = random(1);    
  32.         if (r > .25) {
  33.           stroke(0);
  34.           c++;
  35.         }
  36.         else {
  37.           noStroke();
  38.         }      
  39.         arc(x, y, step, step, (i*PI/2)-0.01, ((i+1)*PI/2)+0.01);
  40.         if (c==4) {
  41.           fill(200);
  42.           strokeWeight(3);
  43.           //ellipse(x, y, step*.75, step*.75);
  44.         }
  45.       }
  46.     }
  47.   }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement