sketch
/* Austin Garcia
Section C
aegarcia@andrew.cmu.edu
Project - 02
*/
// Simple beginning template for variable face.
var eyeSize = 20;
var faceWidth = 60;
var faceHeight = 150;
var pupilSize = 5;
var randomColor = color(random(255),random(255),random(255));
//var eyebrowR = 225
//var eyebrowL = 115
function setup() {
createCanvas(300, 300);
}
function draw() {
background(180);
fill(245, 245, 220)
ellipse(width / 2, height / 2, faceWidth, faceHeight);
var eyeLX = width / 2 - faceWidth * 0.25;
var eyeRX = width / 2 + faceWidth * 0.25;
var pupilLX = width / 2 - faceWidth * .25;
var pupilRX = width / 2 + faceWidth * .25;
ellipse(eyeLX, height / 2, eyeSize, eyeSize);
ellipse(eyeRX, height / 2, eyeSize, eyeSize);
// eyebrows
// line (eyeLX + 10, height - 100, eyeLX - 5, eyebrowL)
//line (eyeRX + 10, height - 100, eyeLX - 5, eyebrowR)
// pupils
var randomColor = color(random(255),random(255),random(255));
fill(randomColor)
if (mouseY > 150)
fill(0)
ellipse(pupilLX, height / 2, pupilSize, pupilSize);
ellipse(pupilRX, height / 2, pupilSize, pupilSize);
}
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(50, 100);
faceHeight = random(100, 200);
eyeSize = random(10, 30);
pupilSize = random(2, 8);
// eyebrowL = random(100 - 120)
// eyebrowR = random(210 - 230)
}