swarstad-face-sketch
// Treat Swarstad
// 15-104 A
//tswarsta@andrew.cmu.edu
//Project 02 -Variable -Face
var eyeSize = 100;
var faceWidth = 350;
var faceHeight = 350;
var mouthsize=100;
var cheek=50;
function setup() {
createCanvas(640, 480);
}
function draw() {
noStroke();
background(0,255,255);
fill(255,224,189);
ellipse(width / 2, height / 2, faceWidth, faceHeight);
var eyeLX = width / 2 - faceWidth * 0.25;
var eyeRX = width / 2 + faceWidth * 0.25;
fill(250,128,114);
var cheekY = height/2 + faceHeight/6; //so cheeks will not appear outside of the face
ellipse(eyeLX, cheekY, cheek, cheek);
ellipse(eyeRX, cheekY, cheek, cheek);
fill(255,255,255);
ellipse(eyeLX, height / 2, eyeSize, eyeSize);
ellipse(eyeRX, height / 2, eyeSize, eyeSize);
fill(0,0,255);
ellipse(eyeLX, height / 2, eyeSize/2, eyeSize/2);
ellipse(eyeRX, height / 2, eyeSize/2, eyeSize/2);
fill(0,0,0);
ellipse(eyeLX, height / 2, eyeSize/4, eyeSize/4);
ellipse(eyeRX, height / 2, eyeSize/4, eyeSize/4);
fill(255,0,0);
var mouthY = height/2+faceHeight*0.25; // so mouth will appear within the face
ellipse(width/2, mouthY, mouthsize/2, mouthsize/2);
fill(0,0,0);
ellipse(width/2, mouthY, mouthsize/3, mouthsize/3);
fill(0,255,0);
}
function mousePressed() {
faceWidth = random(50, 500);
faceHeight = random(50, 500);
eyeSize = random(10, 120);
mouthsize = random(50,150);
cheek = random(25,75);
clear();
}