void setup(){
size(480,480);
smooth();
}
void draw()
{
// println("I’m drawing");
// println(frameCount);
stroke(0);
//Background
background(255);
if (keyPressed)
if ((key==ENTER)) {
background(random(107, 245), random(0, 225), random(0, 225), 100);
}
fill(242,210,110);//arm1
strokeWeight(10);
pushMatrix();
translate(370,410);
rotate((mouseY-367)/548.0);
translate(-370,-410);
beginShape();
curveVertex(360,390);
curveVertex(350,400);
curveVertex(360,450);
curveVertex(370,470);
curveVertex(390,490);
curveVertex(410,500);
curveVertex(430,470);
curveVertex(410,430);
curveVertex(380,400);
curveVertex(355,390);
curveVertex(345,400);
curveVertex(360,450);
endShape();
popMatrix();
beginShape();//body head
curveVertex(255,10);
curveVertex(240,15);
curveVertex(230,25);
curveVertex(230,60);
curveVertex(180,65);
curveVertex(120,85);
curveVertex(85,120);
curveVertex(40,200);
curveVertex(21,260);
curveVertex(31,310);
curveVertex(55,340);
curveVertex(81,361);
curveVertex(104,387);
curveVertex(78,518);
curveVertex(390,517);
curveVertex(369,401);
curveVertex(378,380);
curveVertex(420,340);
curveVertex(440,260);
curveVertex(400,160);
curveVertex(330,70);
curveVertex(280,60);
curveVertex(300,50);
curveVertex(320,40);
curveVertex(320,25);
curveVertex(285,20);
curveVertex(270,30);
curveVertex(260,40);
curveVertex(246,19);
curveVertex(242,20);
endShape();
beginShape();//arm2
pushMatrix();
translate(110,400);
rotate(-(mouseY-367)/548.0);
translate(-110,-400);
curveVertex(110,380);
curveVertex(80,390);
curveVertex(44,450);
curveVertex(37,480);
curveVertex(50,509);
curveVertex(80,519);
curveVertex(113,482);
curveVertex(120,448);
curveVertex(129,399);
curveVertex(107,379);
curveVertex(80,389);
curveVertex(45,451);
curveVertex(40,460);
endShape();
popMatrix();
fill(255);//eyes
strokeWeight(10);
ellipse(340,180, 125, 125);//right eye
ellipse(220,180, 125, 125);//left eye
fill(0);//black eyes
strokeWeight(10);
float d1= dist(mouseX,mouseY,340,180);
float d2= dist(mouseX,mouseY,220,180);
if(d1<=47.5)
{
ellipse(mouseX,mouseY,30,30);
ellipse(mouseX-120,mouseY,30,30);
}
if(d2<=47.5)
{
ellipse(mouseX,mouseY,30,30);
ellipse(mouseX+120,mouseY,30,30);
}
if(d1>47.5&&d2>47.5)
{
if(mouseX>282.5)
{
float x1= (47.5*mouseX-16150)/d1+340;
float y1= (47.5*mouseY-8550)/d1+180;
ellipse(x1,y1,30,30);
ellipse(x1-120,y1,30,30);
}
else
{
float x2= 220-(10450-47.5*mouseX)/d2;
float y2= (47.5*mouseY-8550)/d1+180;
ellipse(x2,y2,30,30);
ellipse(x2+120,y2,30,30);
}
}
strokeWeight(10);
if (mousePressed) {
fill(242,210,110);
}
else {
fill(255,0,0,0);
}
ellipse(340,180, 125, 125);//right eye
if (mousePressed) {
fill(242,210,110);
}
else {
fill(255,0,0,0);
}
ellipse(220,180,125,125);//left eye
fill(232,152,115);
beginShape();//mouth
strokeWeight(10);
curveVertex(310,230);
curveVertex(250,230);
curveVertex(210,260);
curveVertex(210,284);
curveVertex(250,310);
curveVertex(285,316);
curveVertex(320,310);
curveVertex(350,285);
curveVertex(350,260);
curveVertex(310,230);
curveVertex(250,230);
curveVertex(210,270);
endShape();
fill(102,43,9);//mouth 2
float w = map(mouseX, 0, height, 255, 284);
float v = map(mouseX, 0, height, 305, 277);
bezier(205,273,258,w,318,w,350,273);
bezier(205,273,266,v,308,v,350,273);
fill(197,44,36);//face red
noStroke();
ellipse(110,280,120,120);
ellipse(400,280,80,110);
}