void setup() {
size(600, 400);
background(255);
}
void draw() {
background(255);
fill(#E3DBC3);
rectMode(CENTER);
rect(300, 200, 100, 100);
fill(255, 255, 255);
//bouchef
pushStyle();
float bouche1 =0;
float bouche2 =-PI;
float boucheH =230;
if (keyPressed == true ) {
bouche1 = PI;
bouche2 = 0;
boucheH = 220;
}
fill(#F0D7ED);
arc(300, boucheH, 20, 22, bouche2, bouche1, CHORD);
popStyle();
//cheveux
pushStyle();
fill(63, 0, 0);
beginShape();
vertex(250, 150);
vertex(350, 150);
vertex(350, 175);
vertex(330, 175);
vertex(330, 165);
vertex(270, 165);
vertex(270, 175);
vertex(250, 175);
endShape(CLOSE);
popStyle();
//tronc
pushStyle();
color aColor = color( random(255), random(255), random(255) );
//frameRate(1);
if (mousePressed == true) {
fill(aColor);
} else {
fill(0, 0, 0);
}
rectMode(CENTER);
rect(300, 310, 100, 100);
popStyle();
// yeux
fill(0, 0, 0);
ellipseMode(CENTER);
ellipse(275, 195, 8, 12);
ellipseMode(CENTER);
ellipse(325, 195, 8, 12);
//cravattes et cou
pushStyle();
fill(#E3DBC3);
triangle(270, 260, 330, 260, 300, 340);
triangle(300, 250, 295, 260, 305, 260);
fill(255, 0, 0);
triangle(300, 305, 290, 275, 310, 275);
triangle(300, 260, 290, 270, 310, 270);
popStyle();
//boutons
pushStyle();
fill(255, 255, 255);
ellipseMode(CENTER);
ellipse(290, 265, 8, 8);
ellipseMode(CENTER);
ellipse(310, 265, 8, 8);
ellipseMode(CENTER);
ellipse(300, 347, 8, 8);
popStyle();
//bras
float bras2 = 305;
if (keyPressed == true ) {
bras2 = 255;
} else {
bras2 = 305;
}
fill(#E3DBC3);
rectMode(CENTER);
rect(365, bras2, 10, 80);
rectMode(CENTER);
rect(235, bras2, 10, 80);
//epaules
ellipseMode(CENTER);
ellipse(245, 275, 10, 20);
ellipseMode(CENTER);
ellipse(355, 275, 10, 20);
}
//