xxxxxxxxxx
53
function setup() {
createCanvas(400, 400);
}
function draw() {
background(220);
// layer 1
// body
fill(255, 125, 125); // color
noStroke();
ellipse(200, 335, 50, 100); // Head
// Hair 160(), 165(), 180(left/right), 170()
stroke(0);
strokeWeight(2);
line(300, 50, 140, 120); // Left hair
line(300, 50, 240, 120); // Right hair
// layer 2
// Face
fill(204, 162, 131); // Skin color
noStroke();
ellipse(200, 200, 300, 180); // Head
// Eyes
fill(255);
ellipse(170, 180, 30, 20); // Left eye
ellipse(230, 180, 30, 20); // Right eye
// Pupils (move with mouse)
fill(0);
let pupilX = constrain(mouseX, 160, 180);
let pupilY = constrain(mouseY, 170, 190);
ellipse(pupilX, 180, 10, 10); // Left pupil
ellipse(pupilX + 60, 180, 10, 10); // Right pupil
// Mouth
fill(200, 0, 0);
arc(200, 230, 50, 20, 0, PI); // Smiling mouth
// Nose
fill(130, 104, 84);
triangle(195, 190, 205, 190, 200, 210);
// Eyebrows
stroke(0);
strokeWeight(4);
line(160, 165, 180, 170); // Left eyebrow
line(220, 170, 240, 165); // Right eyebrow
}