It was a lot of fun deciding what to change and what style to approach this project with. It was little challenging finding the right places to put random face features but I was able to use the sample code to infer how to make changes.
//Jia Ning Liu
//jianingl@andrew.cmu.edu
//Section D
var eyeSize = 20;
var faceWidth = 100;
var faceHeight = 150;
var mouthLength = 30
var colorR = 200
var colorG = 200
var colorB = 200
var mouthStart = 30
var mouthHeight = 30 //controls the y coordinate of the mouth
var hairRadius = 40 //controls size of hair
var noseLength = 30
function setup() {
createCanvas(480, 640);
}
function draw() {
noFill()
background(204, 255, 204);
strokeWeight(5); //increases stroke weight to give face a more graphic feel
fill (colorB, colorG, colorR); //generated a random RGB color
ellipse(width / 2, height / 2 - 80, hairRadius); // creates hair of different sizes
fill (colorR, colorG, colorB);
ellipse(width / 2, height / 2, faceWidth, faceHeight);
var eyeLX = width / 2 - faceWidth * 0.25;
var eyeRX = width / 2 + faceWidth * 0.25;
fill (colorG, colorB, colorR);
ellipse(eyeLX, height / 2, eyeSize, eyeSize);
ellipse(eyeRX, height / 2, eyeSize, eyeSize);
//generates a random length of line for the mouth
line(width / 2 - mouthStart, height / 2 + mouthHeight, width / 2 + mouthLength, height / 2 + mouthHeight);
fill(colorB, colorG, colorR);
rect(width / 2, height / 2, 5, noseLength); // generates different nose lengths
}
function mousePressed() {
faceWidth = random(75, 150);
faceHeight = random(100, 200);
eyeSize = random (10, 30)
mouthLength = random (20,80)
colorR = random(1,256)
colorG = random(1,256)
colorB = random (1,256)
mouthStart = random (20,80)
mouthHeight = random (20,50)
hairRadius = random (100,200)
noseLength = random (10,40)
}