Tuesday, September 18, 2012


Mustang Checker Board




Final Checker Pattern

void Whole(float x_coord, float y_coord)
{
  PImage Pony;   //create two image objects
  Pony = loadImage("mustang.jpg"); 
  image(Pony, x_coord, y_coord, width/5, height/5);
}
void Spiral(float x_coord, float y_coord)
{
  PImage Mustang;
  Mustang = loadImage("MustangLogo.jpg");
  image(Mustang, x_coord, y_coord, width/5, height/5);
}

void setup()
{
  size(1000, 600);
  int x, y;

  for (y=0;y<5;y++)
  {
    for (x=0;x<5;x++)
    {
      if (y%2==0)  //determine if you are on an even row
      { 
        if (x%2==1)  //determine if you are on an even column
        {
          Spiral(x*width/5, y*height/5);
        }
        else
        {
          Whole(x*width/5, y*height/5);
        }
      }
      else
      {
        if (x%2==1)
        {
          Whole(x*width/5, y*height/5);
        }
        else
        { 
          Spiral(x*width/5, y*height/5);
        }      
      }
    }
  } 
 save("MustangChecker.jpg");  
}


Spiral Square Pattern

void setup()
{
  size(540,410);
  PImage Mustang;                              
  Mustang = loadImage("mustang.jpg");            
  image(Mustang, 0, 0, width, height);
  
  int x,y;
  translate (width/2, height/2);
    
    for(y=0;y<10;y++)
    {
        for(x=0;x<100;x++)
      {
        pushMatrix();
        rotate(radians(x*45));
        image(Mustang,x*5,y*25,width/10,height/10);
        popMatrix();
       }
    }
  save("MustangLogo.jpg");
}




No comments:

Post a Comment