//Jai Sawkar
//Section C
//jsawkar@andrew.cmu.edu
//Project-02: Variable Face
var milkBody = '#99dfff';
var milkDark = '#008bcc';
var milkDark1 = '#80d7ff';
var mouth1 = 44;
var mouth2 = 131;
var mouth3 = 171;
var compli1 = 179;
var compli2 = 231;
var compli3 = 255;
var pupil = 9.5;
var pupilLeft2 = 274;
var pupilRight = 321;
var eyeLeft = 0;
var eyeRight = 0;
var bg1 = 230;
var bg2 = 247;
var bg3 = 255;
var m1 = 299;
var m2 = 239;
var m3 = 42;
var m4 = 17;
function setup() {
createCanvas(640, 480);
}
function draw() {
background(bg1, bg2, bg3);
stroke(1)
//milkcarton
fill(milkBody);
quad(217.4, 132.1, 301.1, 127.4, 307.8, 142.3, 225.4, 147.7);
quad(225.4, 147.7, 257.9, 190.7, 339.4, 179.6, 307.8, 142.3);
quad(257.9, 190.7, 339.4, 179.6, 339.3, 283.5, 261, 298);
//shadow1
fill(milkDark1);
quad(183.5, 178.6, 185.4, 280.4, 261.1, 298.1, 257.9, 190.7);
triangle(257.9, 190.7, 183.5, 178.6, 225.4, 147.6);
//shadow2
fill(0, 139, 204, 80);
noStroke()
triangle(183.5, 178.7, 231.1, 154.9, 225.4, 147.7);
//shadow3
fill(0, 139, 204, 80);
triangle(183.5, 178.7, 242.7, 171.9, 231, 154.8)
stroke(1)
line(183.5, 178.7, 242.7, 171.9)
//faces
noStroke()
//face1
fill(milkDark)
//left and right eye
ellipse(278, 215, eyeLeft)
ellipse(323, 210, eyeRight)
//pupil1
noStroke()
fill(compli1, compli2, compli3)
ellipse(pupilLeft2, 213, pupil)
ellipse(pupilRight, 208, pupil)
//mouth1
fill(milkDark)
ellipse(m1, m2, m3, m4)
}
function mousePressed() {
pupil = random(9.5, 14)
pupilLeft2 = random(274, 280)
pupilRight = random(321, 328)
eyeLeft = random(25, 30)
eyeRight = random(25, 30)
bg1 = random(102, 240)
bg2 = random(0, 204)
bg3 = random(204, 255)
m1 = random(290, 310)
m2 = random(239, 250)
m3 = random(30, 50)
m4 = random(10, 24)
}
When beginning the project, I wanted to start with something normal and bland, but once clicked, it would turn into an unexpected reaction. It is for this reason I chose a milk carton and made the initial face quite neutral; once activated, a sense of euphoria fills the little carton, changing his expression & the background with every click.