xxxxxxxxxx
247
let nose = 500;
let Mood1 = 265;
let Mood2 = 100;
let randomWeight = 10;
let colors = ["#FAEDC1","#BFE2A0","#A0BFE2","#E3AAC4","#ACAAE3","#3B76B8"];
let colorLength = colors.length;
function setup() {
createCanvas(600, 600);
background(colors[floor(random(colorLength))]);
strokeWeight(randomWeight);
fill(colors[floor(random(colorLength))])
rect(0,0,300,600)
}
function draw() {
face();
}
function mouseClicked() {
background(colors[floor(random(colorLength))]);
fill(colors[floor(random(colorLength))])
rect(0,0,300,600)
//face variation
nose = random(400,501);
Mood1 = random(0,300);
Mood2 = random(0,300);
randomWeight = random(4, 20);
print(Mood1);
face();
}
//Draws the initial face//
function face(){
//mood = eye + eyebrow
//left
if (Mood1<=100) { //happy
// eye brow
push();
noFill();
strokeWeight(randomWeight);
stroke("#000000");
translate(60, 100);
curve(30, 125, 50, 50, 150, 50, 250, 125);
pop()
// eye
push();
translate(width/4,height/2.5);
beginShape();
vertex(-80,0);
bezierVertex(-30,-50,30,-50,80,0);
bezierVertex(30,50,-30,50,-80,0)
endShape();
ellipse(0,0,50,50);
ellipse(0,0,30,30);
pop()
} else if (Mood1<=200) { //sad
push();
noFill();
strokeWeight(randomWeight);
stroke("#000000");
translate(60, 100);
curve(30, 125, 50, 50, 150, 50, 250, 125);
pop()
// eye
push();
translate(60,100);
curve(30, 125, 50, 150, 150, 125, 250, 125);
// ellipse(0,0,50,50);
// ellipse(0,0,30,30);
pop()
} else { // anger
push();
noFill();
strokeWeight(randomWeight);
stroke("#000000");
translate(60, 30);
curve(30, 125, 50, 150, 150, 175, 250, 200);
pop()
// eye
push();
translate(width/4,height/2.5);
beginShape();
vertex(-80,0);
bezierVertex(-30,-50,30,-50,80,0);
bezierVertex(30,50,-30,50,-80,0)
endShape();
ellipse(0,0,50,50);
ellipse(0,0,30,30);
pop()
}
//Right
if (Mood2<=100) { //happy
// eye brow
push();
noFill();
strokeWeight(randomWeight);
stroke("#000000");
translate(350, 100);
curve(30, 125, 50, 50, 150, 50, 250, 125);
pop()
// eye
push();
translate(width/1.2,height/2.5);
beginShape();
vertex(-80,0);
bezierVertex(-30,-50,30,-50,80,0);
bezierVertex(30,50,-30,50,-80,0)
endShape();
ellipse(0,0,50,50);
ellipse(0,0,30,30);
pop()
} else if (Mood2<=200) { //sad
push();
noFill();
strokeWeight(randomWeight);
stroke("#000000");
translate(350, 100);
curve(30, 125, 50, 50, 150, 50, 250, 125);
pop()
// eye
push();
translate(350,100);
curve(30, 50, 50, 100, 150, 125, 250, 170);
// ellipse(0,0,50,50);
// ellipse(0,0,30,30);
pop()
} else { // anger
push();
noFill();
strokeWeight(randomWeight);
stroke("#000000");
translate(350, 30);
curve(30, 150, 50, 100, 150, 50, 250, 30);
pop()
// eye
push();
translate(width/1.2,height/2.5);
beginShape();
vertex(-80,0);
bezierVertex(-30,-50,30,-50,80,0);
bezierVertex(30,50,-30,50,-80,0)
endShape();
ellipse(0,0,50,50);
ellipse(0,0,30,30);
pop()
}
//nose
push()
noFill();
strokeWeight(randomWeight);
stroke("#000000");
curve(200, 300, 240, 350, 200, nose, 200, nose);
pop()
// top lip
push();
translate(100,300);
fill('#e74545');
noStroke();
arc(175,200,50,20,PI,0);
arc(225,200,50,20,PI,0);
// bottom lip
fill('#E21717');
noStroke();
arc(200,200,100,40,0,PI);
pop();
// //right eye
// push();
// noFill();
// strokeWeight(randomWeight);
// stroke("#000000");
// translate(420,200);
// rotate(8);
// circle(30, 30, 20);
// curveVertex(84, 91);
// curve(rightEye, -1300, 10, -10, 25, 30, 2000, 0);
// pop();
// //left eye
// push();
// strokeWeight(randomWeight);
// stroke("#000000");
// noFill();
// circle(170,250,leftEye);
// pop();
// //Hair
// push();
// fill("#000000");
// translate(0,-100);
// curveVertex(32, 91);
// curve(55, Hair, 555, 206, 78, 240, 30, 6);
// pop();
}