/*
Joanne Chui
Section C
Project 2
*/
var chin = 2
var forehead = 2
var nose = 245
var nosetip = 250
var eyeWidth = 12
var eyeHeight = 2
var r = 10
var g = 10
var b = 10
var mood = 270
var glasses = 2
function setup(){
createCanvas(480, 640);
}
function draw(){
background(213, 219, 227);
var xpt3 = width / 2;
var ypt3 = height / 2;
var xpt2 = xpt3 - 60
var xpt4 = xpt3 + 60
//face
noFill();
strokeWeight(1);
stroke(r, g, b);
beginShape();
curveVertex(xpt2 + forehead, 150); //pt1
curveVertex(xpt2, ypt3 + chin);//pt2
curveVertex(xpt3, ypt3);//pt3
curveVertex(xpt4, ypt3 + chin);//pt4
curveVertex(xpt4 - forehead, 150);//pt5
curveVertex(xpt2 + forehead, 150);//pt6
curveVertex(xpt2, ypt3 + chin);//pt7
curveVertex(xpt2, ypt3 + chin);//pt7
endShape();
//nose
strokeWeight(2);
beginShape();
curveVertex(200,190);
curveVertex(200,190);//1
curveVertex(235, 200);//2
curveVertex(245, nose);//3
curveVertex(nosetip, nose + 10);//4
curveVertex(245, nose + 20);//5
curveVertex(245, nose + 20);
endShape();
//eyes
strokeWeight(1.5);
fill("white");
arc(210, 220, eyeWidth, eyeHeight, PI, 0);//left
arc(210, 220, eyeWidth, eyeHeight / 2, 0, PI);
arc(270, 220, eyeWidth, eyeHeight, PI, 0);//right
arc(270, 220, eyeWidth, eyeHeight / 2, 0, PI);
//pupil
fill(r, g, b);
ellipse(210, 220, eyeHeight / 4, eyeHeight / 4);
ellipse(270, 220, eyeHeight / 4, eyeHeight / 4);
//mouth
triangle(220, 275, 230, 285, 270, mood);
//hair
beginShape();
curveVertex(xpt4 - forehead, 150);
curveVertex(xpt2 + forehead, 150);
curveVertex(xpt2, ypt3 + chin);
curveVertex(xpt2 - 10, ypt3 + chin + 10);
curveVertex(xpt2 - 10, ypt3 + chin);
curveVertex(xpt2 + forehead - 10, 130);
curveVertex(xpt4 - forehead, 142);
curveVertex(xpt4 - forehead, 150);
endShape();
}
function mousePressed(){
chin = random(-80, 0);
forehead = random(-30, 30);
nose = random(225, 240);
nosetip = random(250, 260);
eyeWidth = random(15, 25);
eyeHeight = random(5, 25);
r = random(0, 225);
g = random(0, 225);
b = random(0, 225);
mood = random(260, 300);
glasses = random(1, 3);
}
I was inspired to do more of an abstract face in order to generate more unique results, and wanted as many elements as possible to vary to create interesting combinations. I experimented with the head shape especially because I thought it would impact the way the face would appear the most.
wow!