Katrina Hu – Project 02 – Variable Face

sketch_project2

/*Katrina Hu
15104 C
kfh@andrew.cmu.edu
Project - 02 - Face*/


var eyeSize = 22;
var cheekWidth = 30;
var mouthWidth = 45;
var backgroundColor = 205
 
function setup() {
    createCanvas(640, 480);
    background(252, backgroundColor, 186);
    noStroke();
}
 
function draw() {
    background(252, backgroundColor, 186);
    //chopstick 1
    fill(158, 106, 68);
    rect(100, 270, 540, 7, 20, 0, 0, 20);
    triangle(640, 265, 100, 270, 640, 278);
    //bun shape
    fill(252, 232, 220);
    ellipse(220, 295, 200, 185);
    fill(255, 249, 242);
    ellipse(220, 275, 185, 165);
    triangle(222, 158, 134, 241, 305, 241);
    strokeWeight(2);
    line(250, 200, 250, 220);
    fill(252, 232, 220);
    ellipse(220, 195, 7, 20);
    ellipse(207, 190, 7, 20);
    ellipse(232, 190, 7, 20);
    //chopstick 2
    noStroke(0)
    fill(158, 106, 68);
    rect(100, 320, 540, 7, 20, 0, 0, 20);
    triangle(640, 315, 100, 320, 640, 328);
    //bun eyes
    fill(0, 0, 0)
    ellipse(180, 250, eyeSize);
    ellipse(270, 250, eyeSize);
    fill(255, 255, 255);
    ellipse(180, 245, eyeSize / 3);
    ellipse(270, 245, eyeSize / 3);
    //bun cheeks
    fill(255, 181, 176);
    ellipse(165, 275, cheekWidth, 10);
    ellipse(280, 275, cheekWidth, 10);
    //bun mouth
    fill(189, 100, 87);
    arc(220, 290, mouthWidth, 30, 0, PI, CHORD);
}
 
function mousePressed() {
    cheekWidth = random(25, 40);
    eyeSize = random(20, 30);
    mouthWidth = random(40, 55);
    backgroundColor = random(190, 210)
}

This was a very fun project to do, as I was able to play around with all the different variables and shapes.

Leave a Reply