egrady-project02-variableface

sketch

//Ean Grady
//Section B
//egrady@andrew.cmu.edu
//project-02

var mouth = 25;
var nose = 250;
var eyes = 25;
var eyes2 = 25;
var faceHeight = 150;
var faceWidth = 400;
var x = 0
var y = 0
var z = 0
var x2 = 0
var y2 = 0
var z2 = 0

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

function draw() {
    background (120, 200, 400);

    //hair
    fill (x, y, z)
    triangle(250, 190, 225, 190, 220, 120)
    triangle(250, 192, 275, 190, 260, 100)
    triangle(275, 190, 300, 190, 300, 120)

    //face
    fill (255, 255, 255)
    stroke (0, 0, 0)
    ellipse (300, 225, faceWidth, faceHeight)

    //eyes
    fill (255, 255, 255)
    stroke (0, 0, 0)
    ellipse (170, 220, eyes*4, eyes*2)
    ellipse (420, 220, eyes*4, eyes*2)
    fill (x2, y, z)
    ellipse (170, 220, eyes2, eyes)
    ellipse (420, 220, eyes2, eyes)

    //nose
    line (nose, 180, 330, 240)
    line (nose, 220, 330, 240)

    //mouth 
    fill (0, 0, 0)
    ellipse (300, 260, 50, mouth)
}

function mousePressed() {
    faceWidth = random(350, 450);
    faceHeight = random(100, 200);
    eyes = random(20, 30);
    nose = random(240, 260);
    mouth = random(10, 40);
    eyes2 = random(20, 70);
    x = random (0, 255);
    y = random (0, 255);
    z = random (0, 255);
}

I found that with this project I had a much easier time setting everything up, and I feel as though I’m finally starting to get the hang of things. I still had a hard time attempting to make the face look more visually pleasing/aesthetic, but I am not mad with the results. Hopefully in future projects I will be able to produce a piece that is both functional (i.e. fulfills the requirements) and visually pleasing.

The design for the face came from a drawing I used to do a lot as a kid whenever I had a sketchbook. It’s pretty simplistic, but I thought that it could fit the goals of the project.

Leave a Reply