Friday, 24 August 2012

Code Final Project 2

 Below is the code for all four of my images, each is a seperat code.

////////////////////////////////First Image

void setup() {
  size (400,800);
  background (221,221,221);
  smooth ();
  noStroke ();
 
int x=0;
int y=0;
int r=0;
int d=7;


  while (y<800){
  while (x<400){


   
//tri 
   if (y<400){
    fill (143,45,120);
   }
   else {
     fill(210,121,213);
   }
       triangle (x+30-d,y+40,x+30+d,y+40,x+30,y+2);
   
      
   
//quad   
   if (y<400){
          fill(146,50,8,200);
            }
       else {
           fill (236,172,74,200);       
            }
    quad (random (x-r,x+r),random (y-r,y+r),random(x-r,x+r),random(y+20-r,y+20+r),random(x+20-r,x+20+r),random(y+20-r,y+20+r),random(x+20-r,x+20+r),random(y-r,y+r));
   
   
    x=x+40;
  }
  x=0;
 y=y+40;
  }

}


////////////////////////////////////Second Image


void setup() {
  size (400,800);
  background (221,221,221);
  smooth ();
  noStroke ();
 
int x=0;
int y=0;
int r=10;
int d=7;


  while (y<800){
  while (x<400){


   
//tri 
   if (y<400){
    fill (143,45,120);
   }
   else {
     fill(210,121,213);
   }
       triangle (x+30-d,y+40,x+30+d,y+40,x+30,y+2);
   
      
   
//quad   
    float ran=random (0,2);
    if (ran<1)
            {
           fill (236,172,74,200);
            }
       else {
                  fill(146,50,8,200);
            }
    quad (random (x-r,x+r),random (y-r,y+r),random(x-r,x+r),random(y+20-r,y+20+r),random(x+20-r,x+20+r),random(y+20-r,y+20+r),random(x+20-r,x+20+r),random(y-r,y+r));
   
   
    x=x+40;
  }
  x=0;
 y=y+40;
  }

}


///////////////////////// Third Image



void setup() {
  size (400,800);
  background (221,221,221);
  smooth ();
  noStroke();
 
int x=0;
int y=0;
int r=50;
int d=5;

  while (y<800){
  while (x<400){


   
//tri 
 if (y<400){
    fill (143,45,120);
   }
   else {
     fill(210,121,213);
   }
       triangle (x+30-d,y+40,x+30+d,y+40,x+30,y+2);
   
//quad   
    float ran=random (0,2);
    if (ran<1)
            {
           fill (236,172,74,150);
            }
       else {
                  fill(146,50,8,150);
            }
    quad (random (x-r,x+r),random (y-r,y+r),random(x-r,x+r),random(y+20-r,y+20+r),random(x+20-r,x+20+r),random(y+20-r,y+20+r),random(x+20-r,x+20+r),random(y-r,y+r));
   
   
    x=x+40;
  }
  x=0;
 y=y+40;
  }

}


//////////////////////////////Fourth Image




void setup() {
  size (400,800);
  background (221,221,221);
  smooth ();
  noStroke();
 
int x=0;
int y=0;
int r=150;
int d=1;

  while (y<800){
  while (x<400){


  
//tri
    if (y<400){
    fill (143,45,120);
   }
   else {
     fill(210,121,213);
   }
       triangle (x+30-d,y+40,x+30+d,y+40,x+30,y+2);
  
//quad  
    float ran=random (0,2);
    if (ran<1)
            {
           fill (236,172,74,150);
            }
       else {
                  fill(146,50,8,150);
            }
    quad (random (x-r,x+r),random (y-r,y+r),random(x-r,x+r),random(y+20-r,y+20+r),random(x+20-r,x+20+r),random(y+20-r,y+20+r),random(x+20-r,x+20+r),random(y-r,y+r));
  
  
    x=x+40;
  }
  x=0;
 y=y+40;
  }

}

No comments:

Post a Comment