xxxxxxxxxx
85
let BackColor;
function setup() {
createCanvas(400, 500);
BackColor = color(150); //original background color
}
function mousePressed() {
BackColor = color(random(255), random(255), random(255));//set ramdom color to r,g,b
}
function draw() {
background(BackColor); // set background color with random.
// Shadow of face
noStroke();
fill(0, 0, 0);
ellipse(220, 270, 350, 450);
// Face
noStroke();
fill(255, 223, 199);
ellipse(210, 270, 350, 450);
// Side Bang
let bangThickness = map(mouseX, 0, width, 1, 10); // set the thickness between 1 to 10
stroke(1);
strokeWeight(bangThickness); // Use dynamic strokeWeight for side bangs
noFill();
line(170, 70, 390, 305); // Right side bang
line(170, 70, 44, 200); // Left side bang
// Nose
noFill();
stroke(1);
strokeWeight(2);
arc(160, 320, -160, 120, 1, PI + HALF_PI);
// Lip
noStroke();
fill(245, 157, 157);
ellipse(200, 420, 80, 40);
// Inside the mouth
noStroke();
fill(176, 127, 127);
ellipse(200, 428, 67, 26);
// Eyes
fill(255);
ellipse(100, 225, 70, 35);
ellipse(240, 225, 70, 35);
// Black part of eye
fill(51, 13, 13);
circle(100, 225, 25);
circle(240, 225, 25);
// Light reflection to the eye
fill(255);
let x1 = map(mouseX, 0, width, 90, 95);
let y = map(mouseY, 0, height, 215, 225);
circle(x1, y, 10);
let x2 = map(mouseX, 0, width, 230, 235);
circle(x2, y, 10);
// Double eyelid
stroke(122, 105, 87);
strokeWeight(1.5);
noFill();
arc(100, 223, 70, 35, PI, TWO_PI);
arc(240, 223, 70, 35, PI, TWO_PI);
// Ear shadow
stroke(10);
strokeWeight(1);
arc(328, 322, 60, 90, PI, HALF_PI);
// Earring
fill(250);
noStroke();
circle(330, 365, 20);
}