variableface
var faceWidth = 200;
var faceHeight = 200;
var eyeDistance = 10;
var eyeWidth = 5;
var eyeHeight = 20;
var eyeHeightFORREAL = 20;
var pupilSize = 10;
var r = 150;
var g = 150;
var b = 150;
var mouthY = 50;
var mouthHeight = 30;
var mouthWidth = 30;
var PI = 3.1415;
function setup() {
createCanvas(500, 500);
background(220);
text("p5.js vers 0.9.0 test.", 10, 15);
}
function draw() {
stroke(0);
strokeWeight(2);
background(255);
fill(r, g, b);
//noStroke();
ellipse(width/2, height/2, faceWidth, faceHeight); //head
fill(255);
ellipse(width/2 - eyeDistance, height/2 - eyeHeight, eyeWidth, eyeHeightFORREAL); //eyes
ellipse(width/2 + eyeDistance, height/2 - eyeHeight, eyeWidth, eyeHeightFORREAL);
fill(0);
ellipse(width/2 - eyeDistance, height/2 - eyeHeight, pupilSize);
ellipse(width/2 + eyeDistance, height/2 - eyeHeight, pupilSize);
fill(255);
ellipse(width/2, mouthY, mouthWidth, mouthHeight); //teeth
line(width/2, mouthY, width/2, mouthY - mouthHeight/2);
fill(r - 80, g - 80, b - 80);
arc(width/2, mouthY, mouthWidth, mouthHeight, 11*PI/6, 7*PI/6, CHORD); //bottom mouth part
}
function mousePressed(){
faceWidth = random(200, 300);
faceHeight = random(200, 400);
eyeWidth = random(25, 70);
eyeHeight = random(-10, 30);
eyeHeightFORREAL = random(25,70);
eyeDistance = random(eyeWidth, faceWidth/2 - eyeWidth);
pupilSize = random(5, min(eyeWidth - 10, eyeHeightFORREAL - 10));
mouthY = height/2 + random(30, 70);
mouthHeight = random(20, 80);
mouthWidth = random(20,80);
r = random(125, 200);
g = random(125, 200);
b = random(125, 200);
}