Project 1: My Self Portrait

self-portrait
//Jessie Chen
//Section D
function setup() {
    createCanvas(1000, 1000);
    background(252, 247, 135);
    text("p5.js vers 0.9.0 test.", 10, 15);
}

function draw() {
    //shirt
    noStroke();
    fill(250, 221, 187);
    rect(200, 700, 600, 600, 150);
    fill(128, 36, 25);
    rect(650, 700, 40, 300);
    rect(360, 700, 40, 300);
    arc(600, 1000, 150, 100, -PI, 0);
    arc(450, 1000, 150, 100, -PI, 0);
    //hair
    fill(49, 29, 22);
    rect(230, 190, 530, 650, 300, 280, 50, 50);
    //face
    noStroke();
    fill(250, 221, 187);
    beginShape();
        curveVertex(400, 480);
        curveVertex(400, 480);
        curveVertex(430, 600);
        curveVertex(525, 672);
        curveVertex(610, 680);
        curveVertex(685, 610);
        curveVertex(705, 470);
        curveVertex(680, 360);
        curveVertex(625, 285);
        curveVertex(550, 295);
        curveVertex(485, 400);
        curveVertex(400, 450);
        curveVertex(400, 480); 
        endShape();
    //ear
    fill(250, 221, 187);
    ellipse(375, 475, 55, 100);
    ellipse(372, 525, 30, 40);
    quad(350, 490, 380, 560, 420, 580, 700, 435);
    //neck
    fill(49, 29, 35);
    rect(400, 425, 30, 100, 50);
    fill(250, 221, 187);
    rect(440, 580, 155, 400, 0, 50, 50, 50);
    stroke(49, 29, 22);
    strokeWeight(23);
    strokeJoin(ROUND);
    line(345, 517, 405, 573);
    line(405, 573, 446, 645);
    line(446, 645, 445, 829);
    //eyebrow
    noFill();
    stroke(49, 29, 22);
    strokeWeight(7);
    strokeJoin(BEVEL);
    line(635, 400, 685, 393);
    line(685, 393, 720, 405);
    line(560, 400, 515, 390);
    line(515, 390, 480, 405);
    //eyes
    noStroke();
    fill(255);
    ellipse(672, 455, 53, 25);
    ellipse(657, 455, 53, 28);
    stroke(49, 29, 22);
    strokeWeight(5);
    line(695, 460, 680, 469);
    line(694, 462, 699, 466);
    line(685, 466, 690, 471);
    line(676, 471, 679, 476);
    strokeWeight(7);
    strokeJoin(ROUND);
    line(635, 450, 655, 442);
    line(655, 442, 660, 442);
    line(660, 442, 700, 452);
    fill(255);
    fill(49, 29, 22);
    ellipse(658, 455, 20, 20); //iris
    noFill();
    noStroke();
    fill(255);
    ellipse(530, 455, 55, 28);
    ellipse(515, 460, 60, 28);
    strokeWeight(5)
    stroke(49, 29, 22);
    line(480, 460, 500, 470);
    line(481, 462, 476, 466);
    line(490, 466, 485, 470);
    line(499, 470, 496, 474);
    strokeWeight(7);
    strokeJoin(ROUND);
    line(560, 451, 532, 442);
    line(525, 442, 528, 442);
    line(528, 442, 480, 452);
    fill(49, 29, 22);
    ellipse(528, 455, 20, 20); //iris
    //face shadow
    stroke(221, 132, 101);
    line(628, 425, 615, 450);
    line(615, 462, 615, 480);
    fill(221, 132, 101);
    noStroke();
    ellipse(645, 422, 35, 25);
    ellipse(555, 422, 35, 25);
    arc(375, 470, 30, 50, PI, PI / 6, CHORD);
    ellipse( 385, 480, 10, 55);
    fill(128, 36, 25);
    ellipse(640, 425, 15, 10);
    ellipse(560, 425, 15, 10);
    stroke(221, 132, 101);
    line(459, 648, 490, 665);
    line(587, 688, 563, 685);
    //nose
    noStroke();
    fill(221, 132, 101);
    ellipse(605, 520, 25, 25);
    fill(49, 29, 22);
    ellipse(618, 535, 15, 10);
    ellipse(585, 535, 15, 10);
    //mouth
    fill(221, 132, 101);
    ellipse(600, 585, 55, 25);
    ellipse(600, 605, 50, 35);
    stroke(49, 29, 22);
    line(570, 593, 623, 593);
    line(623, 593, 628, 595);
    noStroke();
    fill(128, 36, 25);
    ellipse(605, 588, 30, 5);
    //face highlight
    noStroke();
    fill(255);
    ellipse(595, 520, 10, 5);
    ellipse(600, 573, 25, 5);
    ellipse(586, 600, 25, 5);
    ellipse(610, 463, 5, 40);
    //glasses
    noFill();
    stroke(128, 36, 25);
    ellipse(520, 465, 135, 120);
    ellipse(685, 465, 135, 120);
    line(585, 440, 623, 440);
    line(456, 440, 403, 455);
    line(745, 440, 708, 455);
    stroke(255);
    arc(515, 465, 120, 100, 0, QUARTER_PI);
    arc(680, 465, 120, 100, 0, QUARTER_PI);
    //earrings
    line(375, 520, 375, 600)
    noStroke();
    fill(255);
    ellipse(375, 600, 30, 30);
    noLoop();
}

It was very hard to figure out how to translate and rotate shapes and I ran out of time so I had to scratch that idea. But overall this project was really fun : D

Leave a Reply