project 01

sketch
function setup() {
    createCanvas(450, 550);
    background(220);
    text("p5.js vers 0.9.0 test.", 10, 15);
}
function draw() {
    background(245,245,220);
    fill(100);
    noStroke();
    triangle(width/2, 400, width,550, 0, 550 );
    if(mouseX > 400){
                //body
       
        background(200,200, random(0,200));
        fill(random(100,200),random(30,150), random(100,255));
        triangle(width/2, 400, width-random(20,50),550, 0, 550-random(20,50) );
        fill(225,200,255);
        strokeWeight(1);
        stroke(100);
        ellipse(width/2 +10, 270, 350, 470);
        fill(255);
        strokeWeight(random(1,10));
        stroke(200,190,255);
        ellipse(125-random(0,10),200,40,130);
        ellipse(325-random(0,20),200,170,60);
        fill(random(0,10),random(20,70),random(10,20));
        circle(125,200,55);
        fill(random(0,10),random(20,70),random(10,20));
        circle(350,200,80);
        strokeWeight(2);
        fill(random(0,255),random(100,200),random(100,200));
        circle(125,200,random(10,40));
        fill(random(100,200),random(0,200),random(100,200));
        circle(350,200,random(30,60));
        strokeWeight(3);
        stroke(200,200,100);
        fill(0);
        //nose
        line(width/2-random(0,7),220-random(0,5), width/2 -20,350 );
        line(width/2 -20,350, 300,300-random(0,7) );
        triangle(width/2 -20,350, width/2 -15, 315, width/2 -7, 350);
        //mouth + teeth
        stroke(60);
        fill(255,30,100);
        arc(width/2,400,100,100,0,PI);
        fill(250);
        rect(width/2-20-random(0,5),400,15,25);
        square(width/2-10-random(0,5),400,20);
        rect(width/2-random(0,5),400,20,30);
        square(width/2+10-random(0,5),400,20);
        square(width/2+20-random(0,5),400,20);
        // hair

    } else {
        //face
        fill(225,200,183);
        strokeWeight(1);
        stroke(100);
        ellipse(width/2 +10, 270, 350, 470);
        //eyes
        fill(250);
        strokeWeight(2);
        stroke(3);
        ellipse(150,210,70, mouseX+40);
        ellipse(340,210,70,mouseX+40);
        fill(78,53,36);
        circle(150,210,30);
        fill(78,53,36);
        circle(340,210,30);
        //nose
        strokeWeight(1);
        fill(225,184,153);
        ellipse(width/2+10, 280, 12, 100);
        ellipse(width/2+10, 324,40,25);
        fill(0);
        circle(width/2,326, 7);
        circle(width/2 + 15,326, 7);
        // mouth
        strokeWeight(10);
        stroke(255,10,30);
        ellipse(width/2, 400, mouseX+20, 95);
        //hair
        strokeWeight(10);
        stroke(0);
        line(width/2 -110,100,mouseX-110,mouseY);
        line(width/2 -90,100, mouseX-90,mouseY);
        line(width/2 -70,100, mouseX-70,mouseY);
        line(width/2 -50,100, mouseX-50,mouseY);
        line(width/2 -30,100, mouseX-30,mouseY);
        line(width/2 -10,100, mouseX-10,mouseY);
        line(width/2 +10,100, mouseX+10,mouseY);
        line(width/2 +30,100, mouseX+30,mouseY);
        line(width/2 +50,100, mouseX+50,mouseY);
        line(width/2 +70,100, mouseX+70,mouseY);
        line(width/2 +90,100, mouseX+90,mouseY);
        line(width/2 +110,100, mouseX+90,mouseY);

        line(width/2 -100,80,mouseX-110,mouseY);
        line(width/2 -80,80, mouseX-90,mouseY);
        line(width/2 -60,80, mouseX-70,mouseY);
        line(width/2 -40,80, mouseX-50,mouseY);
        line(width/2 -20,80, mouseX-30,mouseY);
        line(width/2 ,80, mouseX-10,mouseY);
        line(width/2 +20,80, mouseX+10,mouseY);
        line(width/2 +40,80, mouseX+30,mouseY);
        line(width/2 +60,80, mouseX+50,mouseY);
        line(width/2 +80,80, mouseX+70,mouseY);
        line(width/2 +100,80, mouseX+90,mouseY);
        line(width/2 +120,80, mouseX+90,mouseY);

        line(width/2 -90,60, mouseX-90,mouseY);
        line(width/2 -70,60, mouseX-70,mouseY);
        line(width/2 -50,60, mouseX-50,mouseY);
        line(width/2 -30,60, mouseX-30,mouseY);
        line(width/2 -10,60, mouseX-10,mouseY);
        line(width/2 +10,60, mouseX+10,mouseY);
        line(width/2 +30,60, mouseX+30,mouseY);
        line(width/2 +50,60, mouseX+50,mouseY);
        line(width/2 +70,60, mouseX+70,mouseY);
        line(width/2 +90,60, mouseX+90,mouseY);
        
    }




}

Leave a Reply