Besides the shape and size of the elements in the face, I also explored the variations of gradient and the effect it has on the visual appeal.
sketch
//Shan Wang
//Section A
//shanw1@andrew.cmu.edu
//Project-02
var bgColor = 20
var faceEdge = 0
var eyeSize = 5;
var faceWidth = 100;
var faceHeight = 150;
var faceColor = 130;
var eyeColor = 225;
var eyeLidSize = 25;
function setup() {
createCanvas(640, 480);
}
function draw() {
background(bgColor);
//draw face contour
fill(faceColor-20);
stroke(faceColor-20);
ellipse(width / 2, height / 2, faceWidth+10, faceHeight+10);
//draw face
fill(faceColor);
stroke(faceColor);
ellipse(width / 2, height / 2, faceWidth, faceHeight);
//draw eyes
fill(eyeColor);
stroke(eyeColor);
var eyeLX = width / 2 - faceWidth * 0.25;
var eyeRX = width / 2 + faceWidth * 0.25;
var eyeY = height / 2;
ellipse(eyeLX, eyeY, eyeSize, eyeSize);
ellipse(eyeRX, eyeY, eyeSize, eyeSize);
//draw eyelid
stroke(bgColor+40);
strokeWeight(eyeLidSize/10);
line(eyeLX-eyeLidSize/2,eyeY-eyeSize/2,eyeLX+eyeLidSize/2,eyeY-eyeSize/2);
line(eyeRX-eyeLidSize/2,eyeY-eyeSize/2,eyeRX+eyeLidSize/2,eyeY-eyeSize/2);
}
function mousePressed() {
bgColor = random(0,100);
eyeSize = random(5,20);
eyeLidSize = random(faceWidth/5,faceWidth/4);
faceColor = random(120,170);
eyeColor = random(225,255);
faceWidth = random(120, 240);
faceHeight = random(140,200);
}