/*
Min Lee
Section A
mslee@andrew.cmu.edu
Project-02
*/
//face
var faceWidth = 150
var faceHeight = 150
//use for nose and mouth color
var faceColorR = 255
var faceColorG = 216
var faceColorB = 209
//eyes
var eyeWidth = 25
var eyeHeight = 15
var eyeColor = 255
//eye positioning
var eyeX = 20
var eyeY = 15
//nose positioning
var noseY = 5
var noseHeight = 60
//mouth shape
var mouthWidth = 25
var mouthHeight = 15
var distance = 30
//font
var textPlacement = 0
//stars
var a = 50
function setup() {
createCanvas(640, 480);
background(141,189,193);
}
function draw() {
background(141,189,193);
noStroke();
//face shape
fill(faceColorR, faceColorG, faceColorB);
ellipse(width/2 ,height/2 , faceWidth, faceHeight);
rect(width/2 - faceWidth/2, height/2, faceWidth, height);
//eyebrows
fill(faceColorR/2, faceColorG/2, faceColorB/2);
ellipse(width/2 - eyeX, height/2 - eyeY, eyeWidth, eyeHeight);
ellipse(width/2 + eyeX, height/2 - eyeY, eyeWidth, eyeHeight);
//eyes
fill(0);
ellipse(width/2 - eyeX, height/2 - eyeY + 20, 10, 8);
ellipse(width/2 + eyeX, height/2 - eyeY + 20, 10, 8);
//nose
fill(faceColorR/4*3, faceColorG/4*3, faceColorB/4*3);
ellipse(width/2 - 7.5, height/2 + noseY/3*2, 10, 10);
ellipse(width/2 + 7.5, height/2 + noseY/3*2, 10, 10);
arc(width/2, height/2 + noseY, 15, noseHeight, PI, TWO_PI);
arc(width/2, height/2 + noseY - 1, 15, 10, 0, PI);
//mouth
fill(faceColorR/4*3, faceColorG/4*3, faceColorB/4*3);
arc(width/2, height/2 + noseY + distance, mouthWidth, mouthHeight, 0, PI);
fill(faceColorR/2, faceColorG/2, faceColorB/2);
arc(width/2 - mouthWidth/4, height/2 + noseY + distance, mouthWidth/2 + 5, mouthHeight, PI, TWO_PI);
arc(width/2 + mouthWidth/4, height/2 + noseY + distance, mouthWidth/2 + 5, mouthHeight, PI, TWO_PI);
//ears
fill(faceColorR, faceColorG, faceColorB);
arc(width/2 - faceWidth/2 + 1, height/2 + noseY/3* 4 + 5, 30, 40, HALF_PI, PI + HALF_PI);
arc(width/2 + faceWidth/2 - 1, height/2 + noseY/3* 4 + 5, 30, 40, PI + HALF_PI, HALF_PI);
fill(faceColorR/4*3, faceColorG/4*3, faceColorB/4*3);
arc(width/2 - faceWidth/2 + 1, height/2 + noseY/3* 4 + 5, 15, 20, HALF_PI, PI + HALF_PI);
arc(width/2 + faceWidth/2 - 1, height/2 + noseY/3* 4 + 5, 15, 20, PI + HALF_PI, HALF_PI);
//chin
stroke(faceColorR/4*3, faceColorG/4*3, faceColorB/4*3);
strokeWeight(2);
noFill();
beginShape();
curveVertex(width/2 - 10, height/2 + 50 + noseY + distance);
curveVertex(width/2 - 10, height/2 + 50 + noseY + distance);
curveVertex(width/2 - 5, height/2 + 55 + noseY + distance);
curveVertex(width/2 + 5, height/2 + 55 + noseY + distance);
curveVertex(width/2 + 10, height/2 + 50 + noseY + distance);
curveVertex(width/2 + 10, height/2 + 50 + noseY + distance);
endShape();
//shirt
fill(0);
strokeWeight(1);
rect(width/2-faceWidth/2, height - 60, faceWidth, 60);
fill(faceColorR, faceColorG, faceColorB);
arc(width/2, height - 60, faceWidth, 40, 0, PI);
//moving text
noStroke();
fill('DarkCyan');
textSize(50);
textFont('Helvetica');
text('bald is beautiful.', textPlacement, 100);
textPlacement = textPlacement + 2
if (textPlacement > 640) {
textPlacement = -350
};
//stars
fill(255,215,0);
rect(width/4, height/4 * 3, 50, 50);
rect(width/2 + 100, height/4 + 20, 50, 50);
fill(141,189,193);
//bottom left star
arc(width/4, height/4 * 3, a, a, 0, HALF_PI);
arc(width/4 + 50, height/4 * 3, a, a, HALF_PI, PI);
arc(width/4, height/4 * 3 + 50, a, a, PI + HALF_PI, TWO_PI);
arc(width/4 + 50, height/4 * 3 + 50, a, a, PI, PI + HALF_PI);
//top right star
arc(width/2 + 100, height/4 + 20, a + 2.5, a + 2.5, 0, HALF_PI);
arc(width/2 + 150, height/4 + 20, a + 2.5, a + 2.5, HALF_PI, PI);
arc(width/2 + 100, height/4 + 70, a + 2.5, a + 2.5, PI + HALF_PI, TWO_PI);
arc(width/2 + 150, height/4 + 70, a + 2.5, a + 2.5, PI, PI + HALF_PI);
}
function mousePressed() {
faceWidth = random(130,170);
faceHeight = random(110,190);
faceColorR = random(141,255);
faceColorG = random(80,255);
faceColorB = random(36,170);
eyeX = random(20,30);
eyeY = random(20,30);
eyeWidth = random(15,25);
eyeHeight = random(10,15);
noseY = random(0, 20);
mouthWidth = random(20, 25);
mouthHeight = random(15,20);
distance = random(20,35);
a = random(50,60);
}
For my project, I wanted to create a message that resonates in my heart. While the variability in the faces that I created is not significant, I went for this effect to show that being a bald, green-skinned person does not make one any different than being a bald, orange-skinned person. Bald is beautiful, folks.