//Michelle Janco
//mjanco@andrew.cmu.edu
//15-104 Section B
//Project - 2
var eyeSize = 40;
var faceWidth = 200;
var faceHeight = 230;
var mouthWidth = 60;
var mouthHeight = 30;
var faceColor = 255;
var noseWidth = 50;
var noseHeight = 15;
var pupilSize = 15;
function setup() {
createCanvas(640, 480);
}
function draw() {
background(250,253,169);
noStroke();
fill(faceColor);
ellipse(width / 2, height / 2, faceWidth, faceHeight);
var eyeLX = width / 2 - faceWidth * 0.25;
var eyeRX = width / 2 + faceWidth * 0.25;
//eyes
fill(160,175,179);
ellipse(eyeLX, height / 2, eyeSize, eyeSize);
ellipse(eyeRX, height / 2, eyeSize, eyeSize);
//pupils
fill(0);
ellipse(eyeLX, height / 2, pupilSize, pupilSize);
ellipse(eyeRX, height / 2, pupilSize, pupilSize);
//mouth
fill(112,2,51);
ellipse(width / 2, height / 1.55, mouthWidth, mouthHeight);
//nose
fill(0);
rotate(PI/5.0);
rect(width / 1.55, height / 20.75, noseWidth, noseHeight, 40);
}
function mousePressed() {
// when the user clicks, these variables are reassigned
// to random values within specified ranges.
faceWidth = random(75, 200);
faceHeight = random(180, 230);
eyeSize = random(20, 40);
mouthWidth = random(15, 60);
mouthHeight = random(5, 30);
faceColor = random(100, 255);
noseWidth = random(30, 50);
noseHeight = random(5, 15);
pupilSize = random(5, 15);
}
I was inspired by Edvard Munch’s The Scream, and decided to make a piece that generated different styles and stages of shock or surprise. I chose the off-putting color scheme to reflect the weird expressions. It was hard to figure out the change in color initially, but I figured it out quickly.