Self Portrait

Since the self-portrait needs a lot of different shapes other than the given functions such as rect() or ellipse(), I have played around with the beginShape() and endShape(), utilizing vertex and curveVertex to formulate the curves. I have also tried to use the rotate() function, but since the rotate() function rotates the art board and not the configured shape, I was stuck on creating figures using the built-in vertex functions. The image below is the self-portrait I have created following with the source code on Processing.

color backgroundColor = color(0,132,255);
color black = color(0, 0, 0);

color skin = color(255, 219, 172);
color skinDark = color(241,194,125);

int unit = 72;

void setup() {
  size(720, 720);
}

void draw() {
  background(backgroundColor);
  noStroke();
  strokeWeight(1);
  
  // *NECK
  fill(skinDark);
  rect(unit*4, unit*6, unit*2, unit*1);
  
  // *FACE
  
  fill(skin);
  arc(unit*5, unit*3, unit*4, unit*7, 0, PI);
  
  // *UPPERHEAD
  fill(skin);
  arc(unit*5, unit*3, unit*4, unit*4, PI, TWO_PI);
  
  //*HAIR
  fill(0);
  beginShape();
  curveVertex(unit*4, unit*2);
  curveVertex(unit*4, unit*2);
  curveVertex(unit*3.8, unit*2.8);
  curveVertex(unit*3, unit*3);
  curveVertex(unit*3, unit*3);
  endShape();
  
  beginShape();
  curveVertex(unit*4, unit*2);
  curveVertex(unit*4, unit*2);
  curveVertex(unit*5, unit*3);
  curveVertex(unit*7, unit*3);
  curveVertex(unit*7, unit*3);
  endShape();
  
  beginShape();
  curveVertex(unit*3, unit*3);
  curveVertex(unit*3, unit*3);
  curveVertex(unit*3.2, unit*1.3);
  curveVertex(unit*5.05, unit*1);
  curveVertex(unit*5.05, unit*1);
  endShape();
    
  beginShape();
  curveVertex(unit*3.4, unit*1.85);
  curveVertex(unit*3.4, unit*1.85);
  curveVertex(unit*5.5, unit*0.6);
  curveVertex(unit*6.8, unit*1.5);
  curveVertex(unit*7, unit*3);
  curveVertex(unit*7, unit*3);
  endShape();
 
  // *EYEBROW_LEFT
  beginShape();
  vertex(unit*3.5, unit*3.25);
  vertex(unit*4.5, unit*3.25);
  vertex(unit*4.5, unit*3.4);
  vertex(unit*3.5, unit*3.4);
  endShape();
  
  // *EYEBROW_RIGHT
  beginShape();
  vertex(unit*5.5, unit*3.25);
  vertex(unit*6.5, unit*3.25);
  vertex(unit*6.5, unit*3.4);
  vertex(unit*5.5, unit*3.4);
  endShape();
  
  // *EYE_LEFT
  stroke(0);
  strokeWeight(3);
  fill(skin);
  arc(unit*4, unit*3.9, unit, unit*0.2, PI+0.5, TWO_PI);
  
  // *EYE_RIGHT
  arc(unit*6, unit*3.9, unit, unit*0.2, PI, TWO_PI-0.5);
  
  //*NOSE
  beginShape();
  curveVertex(unit*5, unit*4.1);
  curveVertex(unit*5, unit*4.1);
  curveVertex(unit*4.9, unit*4.7);
  curveVertex(unit*4.5, unit*5.1);
  curveVertex(unit*5, unit*5.2);
  curveVertex(unit*5, unit*5.2);
  endShape();
  
  // *MOUTH
  arc(unit*5, unit*5.2, unit*2, unit*1.5, 0.7, PI-0.7);
  
  // *BODY
  noStroke();
  fill(50);
  beginShape();
  vertex(0, unit*10);
  vertex(0, unit*8);
  vertex(unit*4, unit*7);
  vertex(unit*6, unit*7);
  vertex(unit*10, unit*8);
  vertex(unit*10, unit*10);
  endShape();
}

 

Leave a Reply