He’s back

For this week’s assignment, we were asked to do an art piece with the use of loops. Personally I feel like my previous week’s assignment, the self-portrait, was a fabulous piece of art. However, I needed to implement the use of loops in my piece, so I used for-loops and nested for-loops to create an introduction for Sir. Got Milk Nathan.

One thing that I hope my code can have in the future is implementing more complicated uses of loops and other functions. This week, some of the harder codings were just figuring out nested loops and implementing a timer mechanic based on frameCount. I also like how people implemented external photos and code snippets into an art piece, I think that produces better effects and I’ll try to do that too.

int timer = 0;
int rectDim = 50;


void setup(){
  size(800,800);
  rectMode(CENTER);
}

void draw(){
  background(0);
  if (frameCount % 30 == 0){
    timer++;
    flash();
    if (timer == 21){
      background(255);
      hair();
      face();
      eyes();
      body();
      Nathan();
      Gotmilk();
      stop();
    }
  }
}
  
void flash(){
    pushMatrix();
      translate(width/2, height/2);
      stroke(255);
      rect(0,0, rectDim , rectDim);
    popMatrix();
    println(timer);
  
  if (timer > 4){
      for (int x = 0; x < width; x += rectDim){
        if (frameCount % 30 == 0){
          stroke(255);
          rect(x + rectDim/2, height/2, rectDim, rectDim);
        }
      }
  }
  if (timer > 8){
      for (int x = 0; x < height; x += rectDim){
        if (frameCount % 30 == 0){
          stroke(255);
          rect(width/2, x + rectDim/2, rectDim, rectDim);
        }
      }
  }
   if (timer > 12){
      for (int x = 0; x < height; x += rectDim){
        if (frameCount % 30 == 0){
          stroke(255);
          rect(x + rectDim/2, x + rectDim/2, rectDim, rectDim);
          rect(x + rectDim/2, height - (x + rectDim/2), rectDim, rectDim);
        }
      }
  }
  if (timer > 16){
      for (int x = 0; x < width; x += rectDim){
        for (int y = 0; y < height; y += rectDim){
          if (frameCount % 30 == 0){
          fill(255);
          stroke(255);
          rect(x + rectDim/2, y + rectDim/2, rectDim, rectDim);
          }
        }
      }
      }
      
      
  }
  
void Nathan() {
  textSize(32);
  fill(255, 102, 178);
  text("Heyyyyy", 10, 30); 

}

void Gotmilk() {
  textSize(30);
  fill(255, 255, 255);
  text(" Got \nMilk?\n  :)", 310, 370);
}

void face() {
  //skin
  fill(255, 255, 51);
  ellipse(350, 200, 100, 140);
  noStroke();
  
  //mouth
  fill(0, 0, 0);
  noStroke();
  arc(350, 230, 50, 40, 0, PI, PIE);
  
}

void hair() {
  fill(255, 0, 0);
  noStroke();
  arc(350, 140, 130, 180, 0, PI, PIE);
}

void eyes() {
//sclera
  fill(255, 255, 255);  
  stroke(0, 0, 0);
  strokeWeight(0.5);
  ellipse(350, 180, 40, 50);
  
//pupil
  fill(255, 0, 0);  
  noStroke();
  ellipse(350, 190, 20, 20);
  
}

void body() {
  
  //arms
  stroke(255, 255, 51);
  strokeWeight(30);
  line(280, 320, 220, 400);
  stroke(255, 255, 51);
  strokeWeight(30);
  line(220, 400, 200, 530);
  
  stroke(255, 255, 51);
  strokeWeight(30);
  line(420, 330, 470, 400);
  stroke(255, 255, 51);
  strokeWeight(30);
  line(470, 400, 490, 530);
  
  //neck
  stroke(255, 255, 51);
  strokeWeight(9);
  line(350, 270, 350, 290);
  
  //T-shirt
  fill(0,0,0);
  noStroke();
  rect(350, 410, 150, 250, 15);
  
  //pants
  
  fill(0,76,153);
  quad(275, 515, 270, 820, 340, 820, 350, 515);
  fill(0,76,153);
  quad(350, 515, 355, 820, 425, 820, 425, 515);
  
  fill(102,51,0);
  rect(350, 515, 160, 20);
  
  stroke(255, 255, 51);
  strokeWeight(30);
  line(290, 835, 320, 835);
  line(375, 835, 405, 835);


  

  //sleeves
  noStroke();
  fill(0,0,0);
  triangle(285, 290, 240, 330, 275, 360);
  fill(0,0,0);
  triangle(415, 290, 410, 370, 460, 330);
}

YOUTUBE VID NEEDS TO BE WATCHED IN 1080 RESOLUTION OR IT WONT WORK

http://vimeo.com/user123608994/review/460111802/0c51e48127

Leave a Reply