Margot Gersing – Project 02 – Variable Face

I enjoyed taking my self portrait and adapting it for this project. I did make some changes but I tried to keep the same style. It was also super helpful to learn how to use the curveVector(). It took me a while to figure it out but now that I know how to use it, I know it will come in really handy.

margot-project-02


// Margot Gersing - Project 02 - mgersing@andrew.cmu.edu - Section E
var eyeWidth = 30;
var eyeHeight = 30;
var faceWidth = 300;
var faceHeight = 300;
var noseHeight = 200;
var faceColor = 162;
var noseColor = 178;
var eyeColor = 66;
 
function setup() {
    createCanvas(480, 640);
}
 
function draw() {
    background(202, 211, 227);

    // face
    fill(246, faceColor, 136);
    noStroke();
    ellipse(240, 300, faceWidth,  faceHeight);

    // eyes
    // lids
    noFill();
    strokeWeight(4);
    strokeJoin(ROUND);
    stroke(243, 103, 71);
    beginShape();
    curveVertex(130, 270);
    curveVertex(130, 270);
    curveVertex(150, 250);
    curveVertex(180, 250);
    curveVertex(200, 270);
    curveVertex(200, 270);
    endShape();

    beginShape();
    curveVertex(280, 270);
    curveVertex(280, 270);
    curveVertex(300, 250);
    curveVertex(330, 250);
    curveVertex(350, 270);
    curveVertex(350, 270);
    endShape();

    // eyelash
    strokeWeight(4);
    line(130, 270, 123, 267);
    line(135, 260, 128, 256);
    line(350, 270, 357, 267);
    line(345, 260, 352, 256);

    // iris
    fill(29, eyeColor, 163);
    noStroke();
    ellipse(165, 265, eyeWidth, eyeHeight);
    ellipse(315, 265, eyeWidth, eyeHeight);

    // nose
    fill(255, noseColor, 55);
    triangle(240, noseHeight, 220, 330, 260, 330);

    // mouth
    noFill();
    strokeWeight(6);
    strokeJoin(ROUND);
    stroke(243, 103, 71);
    line(210, 390, 270, 390);
    beginShape();
    curveVertex(210, 390);
    curveVertex(210, 390);
    curveVertex(230, 375);
    curveVertex(250, 375);
    curveVertex(270, 390);
    curveVertex(270, 390);
    endShape();
}
 
function mousePressed() {
    faceWidth = random(270, 450);
    faceHeight = random(250, 450);
    eyeWidth = random(20, 40);
    eyeHeight = random(20, 40);
    noseHeight = random(200, 300);
    faceColor = random(120, 200);
    noseColor = random(160, 200);
    eyeColor = random(30, 110);
    
}

Leave a Reply