var eyeSize = 60;
var faceWidth = 300;
var faceHeight = 350;
var value = 'blue';
function setup() {
createCanvas(640, 480);
}
function draw() {
background(141,209,247);
if (mouseX < width/2)
background(51);
//head
fill(77,47,23);
arc(width / 2, height / 3 + 0.75 * faceHeight, faceWidth * 1.5 , faceHeight * 2.3, PI, TWO_PI);
fill('tan');
ellipse(width / 2,height / 2,faceWidth,faceHeight);
fill(77,47,23)
arc(width / 2, height / 3, faceWidth * 0.9 , faceHeight * 0.6, PI, TWO_PI);
//left eye
fill('white');
var eyeLX = width / 2 - faceWidth * 0.25;
ellipse(eyeLX, height / 2, 1.5 * eyeSize, eyeSize);
//left eyeball (blue iris, black pupil and white glissen)
fill(value);
ellipse(eyeLX + 15, height / 2, 0.5 * eyeSize, 0.5 * eyeSize);
fill(51);
ellipse(eyeLX + 15, height / 2, 0.25 * eyeSize, 0.25 * eyeSize);
fill('white');
ellipse(eyeLX + 10, height / 2, eyeSize / 8, eyeSize / 8);
//right eye
fill('white');
var eyeRX = width / 2 + faceWidth * 0.25;
ellipse(eyeRX, height / 2, 1.5 * eyeSize, eyeSize);
//right eyeball (blue iris, black pupil and white glissen)
fill(value);
ellipse(eyeRX + 15, height / 2, eyeSize / 2, eyeSize /2);
fill(51);
ellipse(eyeRX + 15, height / 2, eyeSize / 4, eyeSize /4);
fill('white');
ellipse(eyeRX + 10, height / 2, eyeSize / 8, eyeSize / 8);
//eyebrows (left then right)
fill(77,47,23);
ellipse(eyeLX, height / 2 - 30 , eyeSize * 1.5, eyeSize / 6);
ellipse(eyeRX, height / 2 - 30, eyeSize * 1.5, eyeSize / 6);
//mouth
noFill();
arc(width / 2, height * 0.66, faceWidth / 4, faceHeight / 4, 0, PI);
}
function mouseClicked() {
if(value === 0) {
value = 'blue';
} else {
value = color(random(0,255), random(0,255), random(0,255));
}
}
function mousePressed() {
faceWidth = random(200, 350);
faceHeight = random(325, 350);
eyeSize = random(35, 50);
}
I really enjoyed this project as I felt that I now have a better understanding of how to use a lot of the code that was established last week and cool new functions introduced this week. I also enjoyed this project in the sense that it was kind of entertaining to play with and trying to understand the ratio of canvas and face features using established values and ratios.