/*Eunice Choe
Section E
ejchoe@andrew.cmu.edu
Project-02
*/
// face shape
var faceW = 200;
var faceH = 250;
// eyes
var eyeSize = 30;
var eyePupil = 10;
// egg color
var eggColorR = 186;
var eggColorG = 215;
var eggColorB = 241;
// mouth
var mouthW = 40;
var mouthH = 15;
// nest
var nestW = 250;
var nestH = 70;
// brows
var browW = 20;
var browH = 5
function setup() {
createCanvas(480, 640);
}
// background
function draw() {
background(230, 160, 160);
// nest back
noStroke();
fill(106, 80, 71);
ellipse(width / 2, height / 2 + 80, nestW, nestH);
// face
noStroke();
fill(eggColorR, eggColorG, eggColorB);
ellipse(width / 2, height / 2, faceW, faceH);
// eye whites
var leftEyeX = width / 2 - faceW*.2;
var rightEyeX = width / 2 + faceW*.2;
fill(255, 255, 255);
ellipse(leftEyeX, height / 2, eyeSize, eyeSize);
ellipse(rightEyeX, height / 2, eyeSize, eyeSize);
// eye pupils
stroke(65, 44, 24);
strokeWeight(7);
ellipse(leftEyeX, height / 2, eyePupil, eyePupil);
ellipse(rightEyeX, height / 2, eyePupil, eyePupil);
// mouth
stroke(85, 85, 85);
strokeWeight(4);
fill(200, 120, 70);
arc(width / 2, height / 2 + 30, mouthW, mouthH, 0, PI, OPEN);
// brows
var leftBrowX = width / 2 - faceW*.3;
var rightBrowX = width / 2 + faceW*.2;
var browY = height / 2 - faceH*.15;
fill(162, 114, 135);
noStroke();
rect(leftBrowX, browY, browW, browH);
rect(rightBrowX, browY, browW, browH);
// nest front
stroke(163, 136, 127);
fill(124, 103, 95);
arc(width / 2, height / 2 + 80, nestW, nestH + 100, 0, PI, OPEN);
// caption
noStroke();
textFont('Georgia');
textSize(20);
textAlign(CENTER);
text('eggs for days!', width / 2, height / 2 + 200);
}
function mousePressed(){
// face
faceW = random(175, 225);
faceH = random(225, 275);
// eye
eyeSize = random(20, 40);
eyePupil = random(1, 20);
// egg color
eggColorR = random(225, 255);
eggColorG = random(225, 255);
eggColorB = random(225, 255);
// mouth
mouthW = random(10, 100);
mouthH = random(5, 30);
// brows
browW = random(15, 40);
browH = random(1, 10);
}
For this project, I was inspired by my love of eggs. I began experimenting with egg sketches on illustrator and ultimately decided to put my eggs in a nest. I also decided to change the color, eyes, brows, and mouth so that a new egg would appear on every click. This project was more challenging than the last one, but I still had a lot of fun.