Variable Facevar faceWidth = 200
var faceHeight = 300
var faceColor = 255
var eyeSize = 40
var eyeL = 20
var eyeR = 20
var r = 0
var g = 0
var b = 0
var mouth = 1
function setup() {
createCanvas(480,640);
}
function draw() {
background(180);
fill(r,g,b);
ellipse(width/2,height/2,faceWidth, faceHeight);
fill(255);
ellipse(eyeL,height/2,50,30); ellipse(eyeR,height/2,50,30);
fill(111, 78, 55);
ellipse(eyeL,height/2,20,20); ellipse(eyeR,height/2,20,20);
fill(255);
stroke(0,0,0);
strokeWeight(1);
if(eyeL<=width/2-faceWidth/4 & eyeR<=width/2+faceWidth/4){
triangle(width/2, height/2, width/2, height/2+faceHeight/5, width/2-faceWidth/4, height/2+faceHeight/8); }else if(eyeL>=width/2-faceWidth/4 & eyeR>=width/2+faceWidth/4){
triangle(width/2, height/2, width/2, height/2+faceHeight/5, width/2+faceWidth/4, height/2+faceHeight/8); }else{
triangle(width/2, height/2, width/2+faceWidth/8, height/2+faceHeight/5, width/2-faceWidth/8, height/2+faceHeight/5); }
if(mouth == 1){
fill(0);
arc(width/2,height/2+faceHeight/4,70,50,0,PI,CHORD); noFill();
strokeWeight(3);
arc(eyeL,height/2-30,70,40,PI,2*PI);
arc(eyeR,height/2-30,70,40,PI,2*PI);
strokeWeight(1);
}else if(mouth == 2){
fill(225,0,0);
arc(width/2,height/2+faceHeight/3,70,50,PI,2*PI,CHORD); stroke(255,0,0);
strokeWeight(5);
line(eyeL-25,height/2-40,eyeL+25,height/2-20);
line(eyeR+25,height/2-40,eyeR-25,height/2-20);
stroke(0);
strokeWeight(1); }else if(mouth==3){
fill(0);
ellipse(width/2,height/2+faceHeight/3,30,30); strokeWeight(3);
line(eyeL-25,height/2-20,eyeL+25,height/2-40);
line(eyeR+25,height/2-20,eyeR-25,height/2-40);
strokeWeight(1);
}
}
function mousePressed(){
faceWidth = random(180,300);
faceHeight = random(200,340);
faceColor = random(0,255);
eyeL = random(width/2-faceWidth/2+25,width/2-25);
eyeR = random(width/2+25,width/2+faceWidth/2-25);
r = random(0,255);
g = random(0,255);
b = random(0,255);
mouth = int(random(1,4));
}