Project 2-Changing Faces

changing_facesDownload
var eyeSize=40;
var faceWidth=250;
var faceHeight=300;
var browHeight=270
var smile=5
var pie=0
var pupil=18
var lidSize=5

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

function draw() {
    background(165, 222, 214);
    strokeWeight(1);
    noFill()
    ellipse(width/2, height/2, faceWidth, faceHeight);
    strokeWeight(2);
    fill(255);
    var eyeL=width/2-faceWidth*0.25
    var eyeR=width/2+faceWidth*0.25
    ellipse(eyeL, height/2, eyeSize); //eyes
    ellipse(eyeR, height/2, eyeSize);
    fill(0);
    ellipse(eyeL, height/2, pupil); //pupils
    ellipse(eyeR, height/2, pupil);
    fill(118, 186, 177);
    arc(eyeL, height/2, eyeSize + lidSize, eyeSize, 9.4, 2*PI); //eyelids
    arc(eyeR, height/2, eyeSize + lidSize, eyeSize, 9.5, 2*PI);
    noFill();
    strokeWeight(4);
    eyeL=width/2-faceWidth*0.35
    eyeR=width/2+faceWidth*0.35
    line(eyeL, 270, 200, browHeight); //brows
    line(eyeR, 270, 275, browHeight)
    arc(width/2, 375, 100, smile, 0, pie*PI);//mouth
}

function mousePressed() {
    browHeight=(random(240, 300) | 0);
    console.log(browHeight);
    smile=random(3, 75);
    pupil=random(10, 30);
    pie=random(0,1);
    eyeSize=random(40, 60);
    lidSize=(0, 6)
}

I decided to make the various expressions of someone who would get punched in the face at a bar.

Leave a Reply