Week 1 – Self-Portrait

After a couple hours of hard work and experimenting with shapes and guessing coordinates, I was finally able to create my very own self-portrait!


You can find the code for this sketch below:

function setup() {
rectMode(CENTER)
createCanvas(600, 600);
}

function draw() {
background(1, 22, 80);
fill(0,127,15)
rect(300,470,600,300)

//Neck
fill(232, 190, 172)
rect(300,420,100,60)

//Face
fill(232, 190, 172)
ellipse(300,250,300,320)


//Eyes
fill(255)
ellipse(240,220,60,40)
ellipse(360,220,60,40)
fill(0)
ellipse(240,220,20,20)
ellipse(360,220,20,20)
fill(255)
ellipse(245,220,7,7)
ellipse(365,220,7,7)

//Nose
triangle(300, 260, 300, 280, 300, 240)

//Mouth
fill(200,0,0)
arc(300,320,100,100,0,HALF_PI*2,CHORD)

//Eyebrows
strokeWeight(3);
line(215,190,260,190)
line(335,190,380,190)

//Hair
fill(0)
arc(300,165,250,170,PI,TWO_PI)
fill(0)
triangle(330,165,350,120,350,186)
triangle(350,165,370,120,370,186)
triangle(370,165,390,120,390,186)

//Body
rect(298,597,400,300)
fill(232, 190, 172)
triangle(250,447,350,447,300,520)

}

The face and eyes were relatively simple to code in, I just needed to utilize ellipses with varying stretches to create the shape of the face and eyes. So are the nose and eyebrows as they are just a simple line. For the hair and mouth, I utilized the arc method and put in arguments to turn them into semi-circles creating the mouth and hair. I also added some triangles in the hair to add some personality to the hair. I also used a triangle to create the effect of a V-neck shirt for the torso. My fashion is basically just black clothes, so I fittingly gave myself a black shirt. I then created a midnight night sky as the background just to round out the whole sketch!

I am just proud of myself that I managed to calculate the correct coordinates of where to put each shape relatively quickly. It was definitely one of the bigger challenges I imagined but ended up not posing much of an issue. For the future, I definitely do think i can improve the facial shape and add more interactive features to give this self-portrait more of a personality.