xxxxxxxxxx
113
let r, g, b;
let on = false;
function setup() {
createCanvas(600, 600);
}
function draw() {
// background
r = random(200, 255);
g = random(200, 255);
b = random(200, 255);
background(r, g, b);
// body
fill(248, 222, 206);
noStroke();
rect(20, 430, 560, 170, 140, 140, 0, 0);
// hair
if (mouseX > 500) {
fill(40);
} else if (mouseX > 400) {
fill(80);
} else if (mouseX > 300) {
fill(120);
} else if (mouseX > 200) {
fill(160);
} else if (mouseX > 100) {
fill(200);
} else if (mouseX > 0) {
fill(240);
}
noStroke();
ellipse(300, 245, 300, 400);
rect(150, 245, 90, 240);
rect(360, 245, 90, 240);
arc(240, 485, 180, 180, HALF_PI, PI);
arc(360, 485, 180, 180, 0, HALF_PI);
// neck
fill(255, 190, 190);
noStroke();
rect(240, 350, 120, 120);
ellipse(300, 470, 120, 40);
// face
fill(255, 218, 216);
noStroke();
ellipse(300, 245, 220, 300);
// ear
fill(255, 218, 216);
noStroke();
ellipse(190, 257, 52, 64);
ellipse(410, 257, 52, 64);
// front hair
if (mouseX > 500) {
stroke(40);
} else if (mouseX > 400) {
stroke(80);
} else if (mouseX > 300) {
stroke(120);
} else if (mouseX > 200) {
stroke(160);
} else if (mouseX > 100) {
stroke(200);
} else if (mouseX > 0) {
stroke(240);
}
strokeWeight(60);
bezier(190, 200, 210, 190, 260, 160, 280, 95);
bezier(400, 200, 390, 200, 350, 160, 320, 95);
// button & neck point
fill(199, 155, 127);
noStroke();
ellipse(300, 510, 20, 20);
ellipse(300, 560, 20, 20);
stroke(199, 155, 127);
strokeWeight(6);
noFill();
arc(300, 470, 116, 40, 0, PI);
// lips
fill(232, 105, 118);
noStroke();
arc(300, 325, 80, 40, 0, PI);
arc(285, 325, 50, 28, PI, 0);
arc(315, 325, 50, 28, PI, 0);
stroke(202, 69, 83);
strokeWeight(4);
line(270, 327, 330, 327);
// earrings
fill(255);
noStroke();
ellipse(190, 290, 20);
ellipse(410, 290, 20);
// nose
fill(255, 190, 190);
noStroke();
triangle(280, 280, 300, 230, 320, 280);
//eyes
fill(0);
ellipse(250, 230, mouseX / 8, mouseY / 8);
ellipse(350, 230, mouseX / 8, mouseY / 8);
}