xxxxxxxxxx
174
let s = 0;
function setup() {
createCanvas(600, 600);
background(220);
angleMode(DEGREES);
}
function draw() {
//backdrop
let c = color("#d66a91");
fill(c);
rect(0, 0, 600, 600);
let cX = 640;
let cY = 480;
lefthand();
body();
strokeWeight(3);
fill(color("#b0305d"));
rect(0, 430, 600, 430);
strokeWeight(2);
fill(color("#dc7f9f"));
ellipse(cX - 300, 500, 100, 50);
fill(color("#d35f88"));
ellipse(cX - 300, 500 - 10, 20, 20);
ellipse(cX - 300 + 5, 500 + 5, 20, 20);
fill(color("#701f3b"));
rect(cX - 300 + 20, 500 - 10, 15, 15);
rect(cX - 300 - 30, 500 - 10, 15, 15, 10, 5, 10, 5);
//candy
// s++;
fill(color("#dc7f9f"));
ellipse(cX - s, cY, 100, 50);
fill(color("#701f3b"));
ellipse(cX - s, cY, 10, 5);
fill(color("#d35f88"));
ellipse(cX - s, cY - 10, 20, 20);
ellipse(cX - s + 5, cY + 5, 20, 20);
fill(color("#701f3b"));
rect(cX - s + 20, cY - 10, 15, 15);
rect(cX - s - 30, cY - 10, 15, 15, 10, 5, 10, 5);
strokeWeight(1);
face();
eyes();
righthand();
fill(0);
text("(" + mouseX + ", " + mouseY + ")", 10, 10);
}
function body() {
fill(color("#cf4f7e"));
push();
translate(180, 300);
rotate(-20);
rect(0, 0, 150, 280, 0, 20, 0, 0);
fill(color("#dc7f9f"));
rect(30, 30, 100, 280, 80, 80, 40, 40);
pop();
}
function face() {
push();
fill(color("#cf4f7e"));
// noStroke();
push();
translate(210, 210);
ellipse(50, -60, 35, 60); //left ear
ellipse(50, -60, 15, 30);
rotate(60);
ellipse(0, 0, 100, 160);
rotate(-90);
ellipse(-80, -30, 35, 60); //right ear
ellipse(-80, -30, 15, 30);
pop();
push(); //face
translate(240, 240);
rotate(140);
ellipse(0, 0, 100, 100);
pop();
push(); //mouth
translate(260, 270);
rotate(45);
// ellipse(20, -10, 70, 100);
rotate(-75);
push();
fill(color("#e9afc3"));
rect(-10, 25, 40, 30, 20, 20, 20, 20);
pop();
ellipse(40, 10, 50, 70);
rotate(25);
ellipse(0, 15, 50, 70);
pop();
pop();
fill(color("#90274c"));
triangle(247, 253, 280, 228, 280, 265);
}
function eyes() {
push(); //eyes
translate(205, 200);
rotate(-32);
fill(color("#e9afc3"));
ellipse(-30, 10, 50, 40);
ellipse(30, 10, 50, 40);
fill(color("#cf4f7e"));
arc(-30, 10, 50, 40, 180, 0, CHORD);
arc(30, 10, 50, 40, 180, 0, CHORD);
fill(0);
ellipse(-30, 15, 15, 10);
ellipse(30, 15, 15, 10);
pop();
}
function righthand() {
//right hand
fill(color("#cf4f7e"));
push();
translate(200, 300);
rotate(100);
rect(0, 0, 150, 30, 20, 30, 30, 20);
pop();
push();
translate(145, 425);
rotate(10);
rect(0, 0, 110, 30, 0, 0, 30, 30);
rotate(-12);
ellipse(100, 30, 60, 40);
pop();
push();
translate(250, 475);
rotate(-20);
ellipse(24, -20, 20, 30);
ellipse(18, -10, 20, 30);
ellipse(10, 0, 20, 30);
pop();
}
function lefthand() {
//left hand
fill(color("#cf4f7e"));
push();
translate(314, 260);
rotate(30);
rect(0, 0, 150, 30, 30, 30, 30);
pop();
push();
translate(420, 330);
rotate(-30);
rect(0, 0, 110, 30, 30, 30, 30, 30);
rotate(-12);
ellipse(100, 30, 60, 40);
pop();
push();
translate(520, 285);
rotate(15);
ellipse(10, -40, 20, 40);
rotate(10);
ellipse(8, -20, 20, 35);
ellipse(6, 0, 20, 35);
rotate(-60);
ellipse(-10, -40, 20, 40);
pop();
}