Adam He – Project 01- Self Portrait

sketch-169.js

/* Adam He
Section A
xiaotiah@andrew.cmu.edu
Project-01 */

function setup() {
    createCanvas(500, 600);
    background(1,92,180);
}

function draw() {
    noStroke();
    // face and neck
    fill(217,174,90);
    rect(58,400,100,50);
    ellipse(110,260,240,310);
    // eyes (white)
    fill(244,242,230);
    arc(60,250,80,80,0,PI,OPEN);
    arc(160,250,80,80,0,PI,OPEN);
    // eyes (black)
    fill(10,10,10);
    arc(66,250,40,40,0,PI,OPEN);
    arc(155,250,40,40,0,PI,OPEN);
    // eyes (small dots)
    fill(150);
    ellipse(68,255,10,10);
    ellipse(160,255,10,10);
    // mouth
    fill(219,37,26);
    ellipse(110,367,97,20);
    // nose
    fill(166,127,44);
    rect(115,280,4,50);
    // hair
    fill(223,195,114);
    arc(50,130,250,250,0,PI);
    ellipse(110,130,240,120);
    arc(180,130,200,200,0,PI+QUARTER_PI,PIE);
    // shirt
    fill(129,204,235);
    quad(58,450,158,450,230,500,-20,500);
    rect(-10,560,238,50);
    fill(220,220,220);
    rect(-10,500,238,60);
}

It was my first time programming and I thought it was impossible to draw a face using codes. Figuring out the coordinates and color parameters, I slowly understood how programming works, and the portrait turned out better than I expected.

Leave a Reply