sketch
//Julianna Bolivar, Section D
var eyeSize = 20;
var pupilSize = 10;
var faceWidth = 100;
var faceHeight = 150;
var skinTone = 1;
var mouth = 1;
var nose = 1;
function setup() {
createCanvas(300, 300);
}
function draw() {
background(180);
if (skinTone <= 1) {
fill(230,204,178); //light skin tone
}
else if (skinTone <= 2) {
fill(221,184,146); //beige skin tone
}
else if (skinTone <= 3) {
fill(189,143,107); //tan skin tone
}
else if (skinTone <= 4) {
fill(156,102,68); //medium skin tone
}
else if (skinTone <= 5) {
fill(127,85,57); //dark skin tone
}
else {
fill(80,57,43); //deep skin tone
}
ellipse(width / 2, height / 2, faceWidth, faceHeight); //head shape
var eyeLX = width / 2 - faceWidth * 0.25; //left eye size
var eyeRX = width / 2 + faceWidth * 0.25; //right eye size
fill(255);
ellipse(eyeLX, height / 2, eyeSize, eyeSize); //left eye
ellipse(eyeRX, height / 2, eyeSize, eyeSize); //right eye
if (mouth <= 1) {
line(140,180,160,180); //small mouth
}
else if (mouth <= 2) {
line(125,180,175,180); //medium mouth
}
else {
line(115,180,185,180); //big mouth
}
fill(229,135,118); //pink for nose
if (nose <= 1) {
circle(width / 2, 160, 18); //circle nose
}
else if (nose <= 2) {
square(143, 155, 13.5); //square nose
} else {
triangle(150, 150, 143, 165, 157, 165); //triangle nose
}
fill(0,0,0); //black pupils
ellipse(eyeLX, height / 2, pupilSize, pupilSize); //left pupil
ellipse(eyeRX, height / 2, pupilSize, pupilSize); //right pupil
}
function mousePressed() {
faceWidth = random(75, 150);
faceHeight = random(100, 200);
eyeSize = random(10, 30);
skinTone = random (0,6);
mouth = random (0,3);
nose = random (0,3);
}