Project-02-Variable-Face-Veronica

sketch


/*
Veronica Wang
Section B
yiruiw@andrew.cmu.edu
Project-02
*/

var eyeSize = 20;
var faceWidth = 100;
var faceHeight = 150;
var ColorR = 255;
var ColorG = 255;
var ColorB = 255;
var smileY = 200;
var gray = 50;

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

}

function draw() {
    background(255, 179, 48);

    //face
    noStroke();
    fill(120, 80, ColorB);
    ellipse(width / 2 - faceWidth / 2 + 25, height / 2 - faceHeight / 2 + 25, faceWidth * 0.5,  faceWidth * 0.5);
    ellipse(width / 2 + faceWidth / 2 - 25, height / 2 - faceHeight / 2 + 25, faceWidth * 0.5,  faceWidth * 0.5);
    fill('white');
    ellipse(width / 2 - faceWidth / 2 + 25, height / 2 - faceHeight / 2 + 25, faceWidth * 0.3,  faceWidth * 0.3);
    ellipse(width / 2 + faceWidth / 2 - 25, height / 2 - faceHeight / 2 + 25, faceWidth * 0.3,  faceWidth * 0.3);
    fill(120, 80, ColorB);
    ellipse(width / 2, height / 2, faceWidth,  faceHeight);

    //body
    fill(120, 80, ColorB);
    ellipse(width / 2, height - 90, faceWidth * 2, height - faceHeight);
    fill('white');
    ellipse(width / 2, height - 90, faceWidth * 1.5, height - faceHeight * 2);

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

    //nose
    fill('black');
    ellipse(width / 2, height / 2 + 10, faceWidth / 5,  faceHeight / 8);

    //mouth
    var dist = height / 2 + smileY;
    noFill();
    stroke(255, 205, 0);
    strokeWeight(5);
    curve(eyeLX, height/2, eyeLX + 20, dist, eyeRX - 20, dist, eyeRX, height/2);
    
}

function mousePressed() {
    faceWidth = random(120, 180);
    faceHeight = random(120, 180);
    eyeSize = random(10, 20);
    ColorR = random(150, 220);
    ColorG = random(150, 220);
    ColorB = random(0, 100);
    smileY = random(faceHeight / 5, faceHeight / 3);
    gray = random(100, 255);
}

Initially I wanted to recreate Miyazaki’s Totoro, but it just started to look more and more like a bear so…it’s a bear now. I enjoyed working on this project and especially trying to figure out which/how geometries should be related. Some of the variables include body color/size, eye color/size, head size, ear size, etc.

Leave a Reply