xxxxxxxxxx
84
function setup() {
createCanvas(600, 600);
background(255);
greencircle(); // Green circle background
hair(); // Hair
skinandbody(); // Skin and body
arms(); // Arms
}
function draw() {
// Mouse-drawn circles
noStroke();
fill(255, 200, 200, 50);
circle(mouseX, mouseY, 24);
top(); // Top and clothing
facialfeatures(); // Eyes and mouth
eyebrows(); // Eyebrows
}
// Green circle background
function greencircle() {
noStroke();
fill(140, 220, 90);
circle(300, 300, 590);
}
// Hair
function hair() {
fill(0);
arc(300, 300, 210, 400, radians(180), radians(270));
arc(300, 300, 210, 400, radians(270), radians(360));
}
// Skin and body
function skinandbody() {
fill(170, 100, 70);
ellipse(300, 220, 120, 170); // Head
quad(280, 300, 320, 300, 340, 350, 260, 350); // Neck area
rect(210, 330, 180, 240); // Body
arc(220, 380, 100, 100, PI, PI + HALF_PI); // Left shoulder curve
arc(380, 380, 100, 100, PI + HALF_PI, TWO_PI); // Right shoulder curve
}
// Arms
function arms() {
rect(170, 380, 40, 190); // Left arm
rect(390, 380, 40, 190); // Right arm
}
// Top and clothing
function top() {
fill(220, 120, 50);
rect(211, 380, 180, 190); // Body clothing
rect(210, 330, 20, 60); // Left sleeve
rect(370, 330, 20, 60); // Right sleeve
}
// Facial features (eyes and mouth)
function facialfeatures() {
// Eyes
fill(220);
ellipse(280, 203, 25, 13); // Left eye white
ellipse(320, 204, 25, 13); // Right eye white
fill(0);
circle(280, 203, 13); // Left pupil
circle(320, 204, 13); // Right pupil
// Mouth
fill(220);
arc(300, 250, 50, 40, radians(0), radians(180)); // Smile
}
// Eyebrows
function eyebrows() {
noFill();
stroke(0);
strokeWeight(4);
arc(280, 190, 20, 20, radians(220), radians(300)); // Left eyebrow
arc(320, 190, 20, 20, radians(250), radians(330)); // Right eyebrow
}