Project-02-Variable Face

sketch

//Naomi Shimada
//15-104 Section D
//Project-02

       
   var r = 255;

   var g = 134;

   var b = 5; 

   var l = 110;   

   var c = 50;

   var h = 50;

   var e = 150;

   var b = 155;

   var d = 19;

   var z = 30;

function setup() {
    createCanvas(640, 480);
    background(0);
}


function draw(){

     
    // REGULAR FACE CODE

       fill(83,39,5);              //hair
    ellipse(300,300,475,900);

    
       strokeWeight(0);
       fill(229,171,110);             //face
    ellipse(300,200,300,400);
    
        strokeWeight(0);
        fill(255);
    ellipse(240,190,50,40);         //white of the eye, right
    
        strokeWeight(0);
        fill (159,56,d);           //brown
    ellipse(240,190,z,z);
        
        strokeWeight(0);
        fill(217,155,88);         //bridge of the nose
    triangle(305,190,330,260,275,260); 

        strokeWeight(0);
        fill(253,208,229);            //cheek L
    rect(200,225,h,c);
  
        strokeWeight(0);
        fill(253,208,229);                   //cheek R
    rect(350,225,c,h);

        fill(83,39,5);                //hair swoop
    ellipse(330,50,250,e);

        strokeWeight(7);           //Left eyebrow 1
        stroke(83,39,5); 
    line(330,165,355,155);
        
        strokeWeight(7);           //Left eyebrow 2
        stroke(83,39,5); 
    line(355,155,380,155);

        strokeWeight(7);           //Left eyebrow 3
        stroke(83,39,5); 
    line(380,155,400,165);

        strokeWeight(0);         //neck
        fill(229,171,110); 
    rect(250,350,100,300);

    strokeWeight(0);
        fill(r,g,b);            //barrett 1
    ellipse(470,100,20,20);

        stroke(r,g,b);
        strokeWeight(0);           //barrett L
    triangle(480,95,500,70,520,110);

        stroke(226,52,123);
        strokeWeight(0);           //barrett R
    triangle(462,105,420,90,435,130);

        strokeWeight(10);
        stroke(83,39,5);          //ribbon L
    line(470,100,460,140);

        strokeWeight(9);
               //ribbon R
    line(470,100,500,135);

        strokeWeight(0);
                  //barrett 1
    ellipse(470,100,20,20);
    
        strokeWeight(9);
        stroke(r,g,b);          //ribbon L Yellow
    line(470,100,500,140);


        strokeWeight(9);                     //ribbon R Color
    line(470,100,540,135);

      
        strokeWeight(0);         //body
        fill(g,r,b); 
    ellipse(300,500,300,150);


    //hair flow
   

        strokeWeight(60);                        //flowing hair brown 
        stroke(83,39,5);
    curve(0,0,478,170,600,400,1000,600);

        fill(83,39,5);                //filler
    ellipse(550,500,195,275);

        fill(83,39,5);                      //hair filler
    ellipse(525,350,125,225);


        strokeWeight(70);              //black flowing hair line
        stroke(0);
    curve(0,0,70,465,480,600,600,600);

   
        strokeWeight(0);           //winking eye
        fill(229,171,110);
    ellipse(370,190,55,45); 

        strokeWeight(7);                        //wink of the eye
        stroke(0);
    curve(10,100,335,190,390,190,190,300);

        //eyelashes starting at inner corner
        strokeWeight(3);
        stroke(0);
        fill(0);
    triangle(332,190,333,195,336,190);

        strokeWeight(3);
        stroke(0);
        fill(0);
    triangle(336,190,339,197,340,190);

        strokeWeight(3);
        stroke(0);
        fill(0);
    triangle(336,190,339,202,341,191);

        strokeWeight(3);
        stroke(0);
        fill(0);
    triangle(341,190,344,202,347,191);

        strokeWeight(3);
        stroke(0);
        fill(0);
    triangle(347,192,350,203,353,192);

        strokeWeight(3);
        stroke(0);
        fill(0);
    triangle(353,193,356,204,359,193);
        
        strokeWeight(3);
        stroke(0);
        fill(0);
    triangle(360,194,363,205,366,194);

        strokeWeight(3);
        stroke(0);
        fill(0);
    triangle(366,194,369,205.5,372,194);

        strokeWeight(3);
        stroke(0);
    triangle(372,194,375,205,378,194);

        strokeWeight(3);
        stroke(0);
        fill(0);
    triangle(378,193,381,204,384,193);

        strokeWeight(3);
        stroke(0);
        fill(0);
    triangle(384,192,387,202,390,192);

        strokeWeight(3);
        stroke(0);
        fill(0);
    triangle(390,190,393,200,396,191);

        strokeWeight(3);
        stroke(0);
        fill(0);
    triangle(396,190,399,197,402,188);

        strokeWeight(0);          //lower lip
        fill(229,171,l);
    quad(240,310,370,310,355,335,255,335);

        strokeWeight(2);
        stroke(229,171,l);         //upper lip R
        fill(229,171,l);
    triangle(240,310,290,300,305,310);
 
        strokeWeight(2);  
        stroke(229,171,l);         //upper lip L
        fill(229,171,l);
    triangle(305,310,330,300,370,310);

        strokeWeight(10);              //smile
        stroke(201,42,88);
    line(240,310,370,310);

        strokeWeight(10);              //smile
        stroke(201,42,88);
    curve(0,0,240,310,370,310,420,300);

        strokeWeight(0);              //teeth
        fill(225);
    quad(248,310,370,310,335,317,262,317);

        strokeWeight(8);           //Undos original Right eyebrow 2
        stroke(229,171,110); 
    line(250,155,225,155);

        strokeWeight(9);           //Undos original Right eyebrow 3
        stroke(229,171,110); 
    line(225,155,205,165);

        strokeWeight(7);           //Right eyebrow 1
        stroke(83,39,5); 
    line(275,165,250,155);

        strokeWeight(7);           //Right eyebrow 2
        stroke(83,39,5); 
    line(250,155,215,b);

        strokeWeight(7);           //Right eyebrow 3
        stroke(83,39,5); 
    line(215,b,205,155);
     
    
}

function mousePressed(){
 
         r = random(0,255);

         g = random(0,255);

         b = random(0,255);

         l = random(100,120);

         c = random(10,85);

         h = random(10,85);

         e = random(150,240);     
        
         b = random(120,155);
   
         d = random(0,105);

         z = random(30,40);
       

    }

I had a lot of fun with this program.  It took a while to make sure draw the original face but once I got into the rhythm of creating the variables, the random variability was fairly easy.

Leave a Reply