xxxxxxxxxx
93
function setup() {
createCanvas(600, 600);
background(255);
//green circle
noStroke();
fill(140, 220, 90);
circle(300, 300, 590);
//hair
fill(0);
arc(300, 300, 210, 400, radians(180), radians(270));
arc(300, 300, 210, 400, radians(270), radians(360));
//head
noStroke();
fill(170, 100, 70);
ellipse(300, 220, 120, 170);
//skin and body
fill(170, 100, 70);
noStroke();
quad(280, 300, 320, 300, 340, 350, 260, 350);
rect(210, 330, 180, 240, 0, 0, 0, 0);
arc(220, 380, 100, 100, PI, PI + HALF_PI);
arc(380, 380, 100, 100, PI + HALF_PI, TWO_PI);
//arms
rect(170, 380, 40, 190);
rect(390, 380, 40, 190);
}
function draw() {
// Paint over
noStroke();
fill(255, 200, 200, 50);
circle(mouseX, mouseY, 24);
//hair
fill(0);
arc(300, 300, 210, 400, radians(180), radians(270));
arc(300, 300, 210, 400, radians(270), radians(360));
//head
noStroke();
fill(170, 100, 70);
ellipse(300, 220, 120, 170);
//mouth
fill(220);
arc(300, 250, 50, 40, radians(0), radians(180));
//eyes
fill(255);
ellipse(280, 203, 25, 13);
ellipse(320, 204, 25, 13);
//eyebrows
noFill();
stroke(0);
strokeWeight(4);
arc(280, 190, 20, 20, radians(220), radians(300));
arc(320, 190, 20, 20, radians(250), radians(330));
//nose
fill(190, 120, 90);
noStroke();
triangle(300, 210, 310, 243, 290, 243);
//nosepin
fill(190, 190, 100);
circle(295, 239, 3);
// movement of left eyeball
let leftEyeX = constrain(map(mouseX, 0, width, 275, 285), 275, 285);
let leftEyeY = constrain(map(mouseY, 0, height, 200, 206), 200, 206);
// movement of right eyeball
let rightEyeX = constrain(map(mouseX, 0, width, 315, 325), 315, 325);
let rightEyeY = constrain(map(mouseY, 0, height, 201, 207), 201, 207);
//eyeballs
fill(0);
circle(leftEyeX, leftEyeY, 13);
circle(rightEyeX, rightEyeY, 13);
//top
fill(220, 120, 50);
rect(211, 380, 180, 190);
rect(211, 330, 20, 60);
rect(371, 330, 20, 60);
}