Thursday, 26 April 2012

My code



int x = 5;
int y = 5;
int w1 = 20;
int w2 = 20;
int w2a = 20;
int h1 = 20;
int h2 = 20;
int h2a = 20;

void setup()
{
  size(1020, 1020);
     
  background(255);
   stroke(0);
  int i=0;
  while (i<200)
  {
    int xoffset = i*85;
   
    int j=0;
    while(j<100)
    {
      int yoffset = j*85;
     
      /*float r = 255-j*i*2;
      float g = 255-j*i*2;
      float b = 255;
      fill (r, g, b);*/
     
       /*float r = random(250,255);
      float g = random(200,255);
      float b = random(200,255);
      fill (r, g, b);*/
     
      int ran  = 0;

       float r1 = random(-ran,+ran);
       float r2 = random(-ran,+ran);

         strokeWeight(random(1,1));
        
         beginShape();
      vertex(xoffset + x  +r1  , y + yoffset+h1  +r2  );//1
      vertex(xoffset + x+w1+(w2/2)-(w2a/2)  +r1  , yoffset+ y+h1+h2/2-(h2a/2)  +r2  );//2
     
      vertex(xoffset + x+w1  +r1  , y+yoffset+random(-ran,+ran)  +r2  );//3
      vertex(xoffset + x+w1+w2  +r1  , y+yoffset+random(-ran,+ran)  +r2  );//4
     
      vertex(xoffset + x+w1+(w2/2)+(w2a/2)  +r1  , y+h1+h2/2-(h2a/2)+yoffset+random(-ran,+ran)  +r2  );//5
      vertex(xoffset + x+w1*2+w2  +r1  , y+h1+yoffset+random(-ran,+ran)  +r2  );//6
     
      vertex(xoffset + x+w1*2+w2  +r1  , y+h1+h2+yoffset+random(-ran,+ran)  +r2  );//7
      vertex(xoffset + x+w1+(w2/2)+(w2a/2)  +r1  , y+h1+h2/2+(h2a/2)+yoffset +random(-ran,+ran)  +r2  );//8
     
      vertex(xoffset + x+w1+w2  +r1  , y+h1*2+h2 +yoffset+random(-ran,+ran)  +r2  );//9
      vertex(xoffset + x+w1  +r1  , y+h1*2+h2 +yoffset+random(-ran,+ran)  +r2  );//10
     
      vertex(xoffset + x+w1+(w2/2)-(w2a/2)  +r1  , y+h1+h2/2+(h2a/2) +yoffset+random(-ran,+ran)  +r2  );//11
      vertex(xoffset + x  +r1  , y+h1+h2 +yoffset+random(-ran,+ran)  +r2  );//12
      endShape(CLOSE);
        
      /*beginShape();
      vertex(xoffset + x+random(-ran,+ran), y + yoffset+h1+random(-ran,+ran));//1
      vertex(xoffset + x+w1+(w2/2)-(w2a/2)+random(-ran,+ran), yoffset+ y+h1+h2/2-(h2a/2)+random(-ran,+ran));//2
     
      vertex(xoffset + x+w1+random(-ran,+ran), y+yoffset+random(-ran,+ran));//3
      vertex(xoffset + x+w1+w2+random(-ran,+ran), y+yoffset+random(-ran,+ran));//4
     
      vertex(xoffset + x+w1+(w2/2)+(w2a/2)+random(-ran,+ran), y+h1+h2/2-(h2a/2)+yoffset+random(-ran,+ran));//5
      vertex(xoffset + x+w1*2+w2+random(-ran,+ran), y+h1+yoffset+random(-ran,+ran));//6
     
      vertex(xoffset + x+w1*2+w2+random(-ran,+ran), y+h1+h2+yoffset+random(-ran,+ran));//7
      vertex(xoffset + x+w1+(w2/2)+(w2a/2)+random(-ran,+ran), y+h1+h2/2+(h2a/2)+yoffset +random(-ran,+ran));//8
     
      vertex(xoffset + x+w1+w2+random(-ran,+ran), y+h1*2+h2 +yoffset+random(-ran,+ran));//9
      vertex(xoffset + x+w1+random(-ran,+ran), y+h1*2+h2 +yoffset+random(-ran,+ran) );//10
     
      vertex(xoffset + x+w1+(w2/2)-(w2a/2)+random(-ran,+ran), y+h1+h2/2+(h2a/2) +yoffset+random(-ran,+ran) );//11
      vertex(xoffset + x+random(-ran,+ran), y+h1+h2 +yoffset+random(-ran,+ran));//12
      endShape(CLOSE);*/
     
     
     
      /*beginShape();
      vertex(xoffset + x, y + yoffset+h1);//1
      vertex(xoffset + x+w1+(w2/2)-(w2a/2), yoffset+ y+h1+h2/2-(h2a/2));//2
     
      vertex(xoffset + x+w1, y+yoffset);//3
      vertex(xoffset + x+w1+w2, y+yoffset);//4
     
      vertex(xoffset + x+w1+(w2/2)+(w2a/2), y+h1+h2/2-(h2a/2)+yoffset);//5
      vertex(xoffset + x+w1*2+w2, y+h1+yoffset);//6
     
      vertex(xoffset + x+w1*2+w2, y+h1+h2+yoffset);//7
      vertex(xoffset + x+w1+(w2/2)+(w2a/2), y+h1+h2/2+(h2a/2)+yoffset );//8
     
      vertex(xoffset + x+w1+w2, y+h1*2+h2 +yoffset);//9
      vertex(xoffset + x+w1, y+h1*2+h2 +yoffset );//10
     
      vertex(xoffset + x+w1+(w2/2)-(w2a/2), y+h1+h2/2+(h2a/2) +yoffset );//11
      vertex(xoffset + x, y+h1+h2 +yoffset);//12
      endShape(CLOSE);*/
     
     
      smooth();
     
      j=j+1;
    }

    i=i+1;
  }
 
}

void draw()
{
 
}

void mousePressed (){
  save (selectOutput()+".png");
}

No comments:

Post a Comment