sketch
//Janet Lee
//Section C
//janetl2@andrew.cmu.edu
//Assignment-02
var eyeSize = 20;
var faceWidth = 100;
var faceHeight = 150;
var noseX = 10;
var noseY =20;
var mouthX = 15;
var mouthY = 5;
var eyebrowX= 15;
var eyebrowY =5;
function setup() {
createCanvas(640, 480);
}
function draw() {
background('#FCA49F');
noStroke();
fill ('#FCC3B2');
//face
ellipse(width / 2, height / 2, faceWidth, faceHeight);
//eyes
var eyeLX = width / 2 - faceWidth * 0.25;
var eyeRX = width / 2 + faceWidth * 0.25;
fill (0);
ellipse(eyeLX, height / 2, eyeSize, eyeSize);
ellipse(eyeRX, height / 2, eyeSize, eyeSize);
//nose
fill ('#A87688');
ellipse (width / 2,height / 2,noseX,noseY);
//mouth
fill (0);
ellipse (width /2 ,280,mouthX,mouthY);
//eyebrow
fill(0);
ellipse (eyeLX,220 ,eyebrowX,eyebrowY);
ellipse (eyeRX, 220, eyebrowX,eyebrowY);
}
function mousePressed() {
// when the user clicks, these variables are reassigned
// to random values within specified ranges. For example,
// 'faceWidth' gets a random value between 75 and 150.
faceWidth = random(75, 150);
faceHeight = random(100, 200);
eyeSize = random(10, 30);
noseX = random (5,15);
noseY = random (10,30);
mouthX = random(5,20);
mouthY = random (3,10);
}