xxxxxxxxxx
73
function setup() {
createCanvas(400, 400);
drawBackground();
drawFace();
drawEyes();
drawEyebrows();
drawHair();
drawBody();
}
function drawBackground() {
background(255);
}
function drawFace() {
fill(255, 224, 189);
noStroke();
ellipse(200, 185, 150, 200);
}
function drawEyes() {
drawEye(168, 200); // Left eye white part
drawEye(232, 200); // Right eye white part
drawPupil(170, 200); // Left pupil
drawPupil(230, 200); // Right pupil
drawEyeHighlight(165, 200); // Left eye highlight
drawEyeHighlight(225, 200); // Right eye highlight
}
function drawEye(x, y) {
fill(250, 250, 240);
ellipse(x, y, 45, 25);
}
function drawPupil(x, y) {
fill(0);
ellipse(x, y, 15, 20);
}
function drawEyeHighlight(x, y) {
fill(245, 245, 235);
ellipse(x, y, 7, 7);
}
function drawEyebrows() {
fill(233, 150, 122);
ellipse(165, 178, 35, 8); // Left
ellipse(230, 178, 35, 8); // Right
}
function drawHair() {
fill(0);
noStroke();
arc(200, 170, 180, 220, PI, TWO_PI, OPEN);
arc(150, 140, 100, 180, PI / 2, PI + QUARTER_PI, OPEN);
arc(250, 140, 100, 180, TWO_PI - QUARTER_PI, PI / 2, OPEN);
rotate(-radians(20));
arc(60, 200, 75, 130, PI / 2, PI + QUARTER_PI, OPEN);
rotate(radians(40));
arc(315, 65, 75, 130, TWO_PI - QUARTER_PI, PI / 2, OPEN);
triangle(170, 115, 200, 150, 200, 80);
triangle(280, 65, 320, 100, 320, 65);
rotate(-radians(20));
}
function drawBody() {
fill(194, 220, 189);
rect(160, 285, 80, 130);
arc(160, 385, 100, 200, PI / 2, (3 * PI) / 2);
arc(240, 385, 100, 200, (3 * PI) / 2, PI / 2);
}