daphnel-Project02-VariableFace

Variable Face

//Daphne Lee
//15-104::1 (9:30am)-Section D
//daphnel@andrew.cmu.edu
//Project-02

var eyeSize = 20;
var faceWidth = 200;
var faceHeight = 200;
var faceInnerW= 150;
var faceInnerH= 150;
var nosePosX=50;
var nosePosY= 20;
var blush= 30;

function setup() {
    createCanvas(480, 640);
}

function draw() {
    //head outside
    background(255, 230, 238);
    fill(155, 155, 155);
    ellipse(width / 2, height / 2, faceWidth, faceHeight);

    //innerface
    fill(256);
    ellipse(width / 2 - 40, height / 2, faceInnerW/1.5,  faceInnerH);
    ellipse(width / 2 + 40, height / 2, faceInnerW/1.5,  faceInnerH);
    ellipse(width / 2, height / 2 +43, faceInnerW/1.5 +25,  faceInnerH/1.7);

    //eyes
    var eyeLX = width / 2 - faceWidth * 0.25;
    var eyeRX = width / 2 + faceWidth * 0.25;
    fill(77,51,25);
    ellipse(eyeLX, height / 2, eyeSize + 20, eyeSize + 20);
    ellipse(eyeRX, height / 2, eyeSize + 20, eyeSize + 20);

    //corner white eyes
    fill(256);
    ellipse(eyeLX-9, height / 2 -17, eyeSize/1.5, eyeSize/1.5);
    ellipse(eyeRX-9, height / 2 -17, eyeSize/1.5, eyeSize/1.5);

    //blush
    fill(255, 204, 204);
    ellipse(width/2 -50, height/2 +21, blush, blush/2);
    ellipse(width/2 +50, height/2 +21, blush, blush/2);

    //nose
    strokeWeight(0);
    fill(255, 204, 0);
    ellipse(width/2, height/2 + 20,nosePosX, nosePosY);

}

function mousePressed() {
    faceWidth = random(190, 250);
    faceHeight = random(190, 250);
    faceInnerW= random(150,165);
    faceInnerH= random(150,165);
    eyeSize = random(20, 30);
    nosePosX = random(30, 60);
    nosePosY = random(10, 40);
    blush= random (20,55);

}

I started with an idea of a penguin in my mind. It was hard for me to try to get the beak down since I wanted to use a triangular shape as the base but I ended up with an ellipse. It’s quite similar to my first project in the way I used the shapes and tried to overlap them in order to get another shape that I wanted. Overall, I think the end result wasn’t that bad.

Leave a Reply