/*Youie Cho
Section E
minyounc@andrew.cmu.edu
Project-02-Variable-Face*/
var eyeSize = 15;
var faceWidth = 200;
var faceHeight = 150;
var cloudW = 40;
var cloudH = 60;
var cloudWs = 30;
var cloudHs = 40;
//eye color
var r = 100;
var g = 100;
var b = 100;
//background color
var rB = 73;
var gB = 129;
var bB = 242;
function setup() {
createCanvas(640, 480);
}
function draw() {
background(250, 140, 155);
fill(rB, gB, bB);
rect(30, 25, 570, 380);
//body
noStroke();
fill(224, 194, 121);
beginShape();
curveVertex(100, 600);
curveVertex(180, 600);
curveVertex(220, 360);
curveVertex(400, 330);
curveVertex(480, 600);
curveVertex(400, 600);
endShape();
//ears
fill(224, 194, 121);
ellipse(260, 200, faceWidth / 4 - 10, faceHeight / 2);
ellipse(380, 200, faceWidth / 4 + 10, faceHeight / 2 + 10);
//face
fill(242, 216, 155);
ellipse(width / 2, 270, faceWidth, faceHeight);
var eyeLX = width / 2 - faceWidth * 0.3;
var eyeRX = width / 2 + faceWidth * 0.3;
//eye
fill(r, g, b);
ellipse(eyeLX, height / 2, eyeSize, eyeSize);
ellipse(eyeRX, height / 2, eyeSize, eyeSize);
noFill();
//nose
fill(171, 129, 26);
triangle(285, 260, 315, 260, 300, 283);
//mouth
noFill();
strokeWeight(3);
stroke(84, 50, 9);
bezier(280, 283, 285, 287, 290, 287, 300, 283);
bezier(300, 283, 310, 287, 315, 287, 320, 283);
//cloud
fill(225)
noStroke();
ellipse(160, 100, cloudWs, cloudHs);
ellipse(180, 100, cloudW, cloudH);
ellipse(200, 100, cloudW, cloudH);
ellipse(220, 100, cloudW, cloudH);
ellipse(240, 100, cloudWs, cloudHs);
//cheeks
fill(255, 189, 158);
ellipse(235, 273, faceWidth / 5, faceHeight / 6);
ellipse(380, 273, faceWidth / 4, faceHeight / 6);
}
function mousePressed() {
faceWidth = random(180, 220);
faceHeight = random(150, 200);
eyeSize = random(10, 20);
cloudW = random(40, 50);
cloudH = random(50, 70);
cloudWs = random(20, 40);
cloudHs = random(30, 40);
r = random(26, 99);
g = random(34, 102);
b = random(4, 201);
rB = random(73, 209);
gB = random(129, 224);
bB = random(242, 255);
}
It was fun to try changing colors and shapes, and I think it was especially meaningful to learn to make these changes within various relationships. It also made me make a connection to the generative art I looked at Looking Outwards.