constructor(x, y, size) {
this.eyeSize = random(10, 30);
this.eyeOffsetX = random(30, 50);
this.eyeOffsetY = random(20, 40);
this.mouthWidth = random(30, 80);
this.mouthHeight = random(10, 30);
this.eyebrowTilt = random(-PI / 6, PI / 6);
this.mood = random(["happy", "sad", "neutral", "surprised"]);
ellipse(this.x, this.y, this.size);
ellipse(this.x - this.eyeOffsetX, this.y - this.eyeOffsetY, this.eyeSize);
ellipse(this.x + this.eyeOffsetX, this.y - this.eyeOffsetY, this.eyeSize);
translate(this.x - this.eyeOffsetX, this.y - this.eyeOffsetY - 10);
rotate(this.eyebrowTilt);
translate(this.x + this.eyeOffsetX, this.y - this.eyeOffsetY - 10);
rotate(-this.eyebrowTilt);
if (this.mood === "happy") {
arc(this.x, this.y + 40, this.mouthWidth, this.mouthHeight, 0, PI);
} else if (this.mood === "sad") {
arc(this.x, this.y + 40, this.mouthWidth, this.mouthHeight, PI, 0);
} else if (this.mood === "neutral") {
line(this.x - this.mouthWidth / 2, this.y + 40, this.x + this.mouthWidth / 2, this.y + 40);
} else if (this.mood === "surprised") {
ellipse(this.x, this.y + 40, this.mouthWidth / 2, this.mouthHeight);
for (let i = 0; i < 5; i++) {
let x = random(50, width - 50);
let y = random(50, height - 50);
let size = random(100, 150);
faces.push(new Face(x, y, size));
for (let face of faces) {