/* Adam He
Section A
xiaotiah@andrew.cmu.edu
Project-02 */
// shape variables
var faceW = 280;
var faceH = 380;
var eyeSize = 50;
var mouthSize = 70;
var noseH = 70;
var noseW = 30;
// color variables
var mouthColor = 200;
var skinColor = 220;
var eyeColor = 80;
function setup() {
createCanvas(630, 480);
}
function draw() {
background(220, 50, 120);
noStroke();
// hair
fill(70,20,130);
ellipse(width/2, height/2.5, faceW*1.2, faceH/2);
// drawing face
fill(skinColor, 180, 95);
ellipse(width/2, height/2, faceW, faceH);
// eye
fill(240);
ellipse(width / 2 - 0.2 * faceW, height / 2, eyeSize, eyeSize);
ellipse(width / 2 + 0.2 * faceW, height / 2, eyeSize, eyeSize);
// pupils
fill(50, 60, eyeColor);
ellipse(width / 2 - 0.2 * faceW, height / 2.1, eyeSize / 3, eyeSize / 3);
ellipse(width / 2+ 0.2 * faceW, height / 2.1, eyeSize / 3, eyeSize / 3);
// nose
fill(skinColor, 20, 170);
rect(width / 2 - noseW / 2, height / 1.8, noseW, noseH);
// mouth
fill(mouthColor, 20, 80);
ellipse(width / 2, height / 2 + faceH / 2.5, mouthSize * 1.4, mouthSize);
}
function mousePressed() {
faceW = random(200, 320);
faceH = random(250, 400);
eyeSize = random(30, 100);
mouthSize = random(20, 100);
skinColor = random(150, 220);
eyeColor = random(20, 180);
noseH = random(20,100);
noseW = random(10, 40);
mouthColor = random(100, 255);
}
This project was more interesting than the previous project because variable faces create an interactive platform between the developer and the viewers. A lot of interfaces are meant to produce an interlinked space between different people, and I am glad that I scripted something a little closer to that kind of program.