//Xinyi Du
//15104 Section B
var eyes = 20;
var mouth = 20;
var face = 100;
var ears = 20;
var r // red
var g // green
var b // blue
var hairDeco = 20; //hair decorations
var hair = 30; //hair
var cloth = 200;
function setup() {
createCanvas(300, 300);
}
function draw() {
background(80);
noStroke();
// clothing
fill(255-r, 255-g, 255-b);
triangle(width / 2, height / 2, width/2-cloth/2, height/2+cloth, width/2+cloth/2, height/2+cloth);
fill(255, 229, 204);
ellipse(width / 2, height / 2, face, face); // face
fill(255, 229, 204);
ellipse(width / 2 - face / 2, height / 2, ears, ears); // left ear
fill(255, 229, 204);
ellipse(width / 2 + face / 2, height / 2, ears, ears); // right ear
fill(255, 102, 102);
ellipse(width/2, height/2+face/4, mouth,); // mouth
var eyeL = width/2 - face/4; // left eye
var eyeR = width/2 + face/4; // right eye
fill(64, 64, 64);
ellipse(eyeL, height/2, eyes, eyes+5);
ellipse(eyeR, height/2, eyes, eyes+5);
//hairstyle
fill(r, g, b);
ellipse(width/2, height/2-face/2, hairDeco, hairDeco); // hair decorations 1
fill(r, g, b);
// hair 1
var x1 = width/2-hair/2;
var y1 = height/2-face/2-hairDeco-hair;
var x2 = width/2+hair/2;
var y2 = height/2-face/2-hairDeco-hair;
var x3 = width/2;
var y3 = height/2-face/2-hairDeco/2;
triangle(x1, y1, x2, y2, x3, y3);
fill(r-30, g-30, b-30);
ellipse(width/2-face/4, height/2-face/3, hairDeco, hairDeco); // hair decorations 2
ellipse(width/2+face/4, height/2-face/3, hairDeco, hairDeco); // hair decorations 3
// hair 2
var x1 = width/2-face/4;
var y1 = height/2-face/3-hairDeco/2;
var x2 = width/2-face/4-hair/2;
var y2 = height/2-face/3-hairDeco/2-hair;
var x3 = width/2-face/4+hair/2;
var y3 = height/2-face/3-hairDeco/2-hair;
triangle(x1, y1, x2, y2, x3, y3);
// hair 3
var x1 = width/2+face/4;
var y1 = height/2-face/3-hairDeco/2;
var x2 = width/2+face/4-hair/2;
var y2 = height/2-face/3-hairDeco/2-hair;
var x3 = width/2+face/4+hair/2;
var y3 = height/2-face/3-hairDeco/2-hair;
triangle(x1, y1, x2, y2, x3, y3);
}
function mousePressed() {
face = random(80, 150);
eyes = random(10, 20);
ears = random(12, 30);
mouth = random(10, 25);
hairDeco = random(10, 30);
hair = random(20, 50);
r = random(10, 250);
g = random(10, 250);
b = random(10, 250);
cloth = random(150, 300);
//
}