var eyeSize = 50
var mouthType = 1
var eyebrowType = 1
function setup() {
createCanvas(480, 640);
}
function draw() {
background(215, 167, 119);
strokeWeight(0);
fill(107, 70, 27); // eyes
ellipse(width/3, height/3, eyeSize);
ellipse(width*2/3, height/3, eyeSize);
if (eyebrowType >=1) { // angry eyebrows
fill(107, 70, 27);
triangle(width/5, height/5, width/4, height/4, width/2, height/4);
triangle(4*width/5, height/5, 3*width/4, height/4, width/2, height/4);
} else if (eyebrowType < 1 & eyebrowType > .5) { // unibrow
strokeWeight(20);
line(width/4, height/5, 3*width/4, height/5);
} else { // arc eyebrows
noFill();
strokeWeight(7);
arc(width/3, height/4, 200, 100, -5/6 * PI, -PI/6);
arc(2*width/3, height/4, 200, 100, -5/6 * PI, -PI/6);
}
noFill(); // nose
strokeWeight(7);
stroke(107, 70, 27);
arc(width/2, height/2, 80, 80, PI/4, 3/4 * PI);
stroke(107, 70, 27); // line mouth
if (mouthType >= 1) {
strokeWeight(7);
line(width/3, 3*height/4, 2*width/3, 3*height/4);
} else if (mouthType < 1 & mouthType > .5) { // open mouth
strokeWeight(0);
fill(107, 70, 27);
ellipse(width/2, 3*height/4, width/2, height/10);
} else { // smile mouth
strokeWeight(7);
arc(width/2, 3*height/4, 200, 100, PI/6, 5/6 * PI);
}
}
function mousePressed() {
eyeSize = random(25, 75);
mouthType = random(1.5);
eyebrowType = random(1.5);
}
I wanted to see what combination of facial features the computer would create, rather than creating combinations myself. While this prevented me from focusing on individual emotions, it’s been fun to see what the computer comes up with.