Project-01-Face-Manuelr

sketch

//Manuel Rodriguez Ladron de Guevara
//Section B 10:30am
//manuelr@andrew.cmu.edu
//Project-01

function setup() {
    createCanvas(600, 600);
    background(194,217,76);
    angleMode(DEGREES);
    smooth();
    //text("p5.js vers 0.5.12 test.", 10, 15);
}

function draw() {

    //background
    rectMode(CENTER);
    noStroke();
    fill(169,207,56);
    //fill(255,198,10);
    rect(300,300,300,400,20);

        //ears
    noStroke();
    fill(236,191,153);   
    rectMode(CENTER);
    rect((width/2)+100, (height/2), 30,50, 10);

    rectMode(CENTER);
    rect((width/2)-100, (height/2), 30,50, 10);

     //hair
    if(mouseX<(width/2)|| mouseY<(height/2)){
        fill(50);
    }else {
        noStroke();
        fill(255,216,0);
    }
    
    rect(300,260,220,220,50,50,10,10);
   

    //neck
    strokeWeight(3);
    stroke(216,170,153);
    fill(236,191,153);
    rect(300,450,60,150);



    //face base
    if(mouseX<(width/2) || (mouseY<(height/2))){
        strokeWeight(3);
        stroke(216,170,153);
        fill(236,191,153);
        ellipseMode(CENTER);
        ellipse(width/2, height/2, 200,300);  
    }
        else{
            noStroke();
    rectMode(CORNERS);
    rect((width/2)-80, (height/2)+60,(width/2)+80, (height/2)-80);

    noStroke();
    triangle((width/2)-80, (height/2)+60,300,450,(width/2)+80, (height/2)+60,30);
        }
        
    

    //mouth
    strokeWeight(5);
    stroke(216,170,153);
    line(width/2-10,height/2+100,310,400);

    //beard
    noFill();
    if(mouseX<(width/2)|| mouseY<(height/2)){
        stroke(50);
    }else {
        stroke(255,216,0);
    }
    //noFill();
    rectMode(CENTER);
    //stroke(50);
    //strokeWeight(8);
    rect(300,410,50,45,5);

    //eyes
    noStroke();
    fill(255);
    rect(260,280,35,20,5,5,10,10);
    rect(340,280,35,20,5,5,10,10);

    //shadow eyes
    noStroke();
    fill(230);
    rect(260,288,25,5,5,5,10,10);
    rect(340,288,25,5,5,5,10,10);



    //line below eyes
    strokeWeight(8);
    stroke(193,144,135);
    line(240,300,270,300);
    line(330,300,360,300);


    //eyeballs
    noStroke();
    fill(151,79,0);
    ellipse(260,280,15,15);
    ellipse(340,280,15,15);

    //pupil
    fill(0);
    ellipse(260,280,8,8);
    ellipse(340,280,8,8);

    //hair2
    if (mouseX<(width/2) || mouseY<(height/2)){
        noStroke();
        fill(50);    
    } else {
        noStroke();
        fill(255,216,0);
    }
    /*noStroke();
    fill(50);*/
    ellipse(300,170,100,50);
    arc(250,180,90,70,-60,150,CHORD);
    arc(210,220,80,60,-60,110,CHORD);
    arc(350,180,70,50,-80,150,CHORD);
    arc(390,220,80,60,-60,110,CHORD);
    arc(370,190,80,60,-60,110,CHORD);
    arc(400,260,70,50,-60,110,CHORD);

    //noStroke();
    //fill(0);
    //rect(300,150,220,100,50,50,10,10);

    //eyebrows
    fill(79,28,0);
    rect(260,260,45,10,5,5,10,10);
    rect(340,260,45,10,5,5,10,10);

    //nose
    strokeWeight(1);
    stroke(216,170,153);
    line(width/2-10,height/2+50,295,305);
    //line(310,350,305,305);
    noStroke();
    fill(216,170,153);
    triangle(width/2-10,height/2+50,295,305,310,345);

}


I started creating an ellipse as the base for the face. Then I drew the ears, as I wanted the hair to come in front of them, to cover them a little bit. Eyes were more time consuming as I was filleting the corners of the rectangle and drawing the pupils too. Hair was tricky as well as I used filled arcs and the result was unexpected and interesting at the same time when I did the right side of the forehead. Finally I wanted to add some conditionals and change the hair colour and the face shape depending on the position of the mouse.

juyeonk-project01-face

sketch

function setup() {
    createCanvas(600, 720);
    
}

    var dir = 1;
    var speed = 0.4;
    var diam = 50;

    
   


function draw() {
    background(140, 196, 249,);
    
    
    //sun and the clouds
    
    

    scale(0.91, 0.91);
    fill(254, 194, 15);
    noStroke ();
    ellipse(158.31,130.26, diam, diam);

    diam += dir * speed;
    if (diam > 147) {
        dir = -dir;
        diam = 147;
    } else if (diam < 120) {
        dir = -dir;
        diam = 120;
    }
    


    
    
    fill (255, 200);
    triangle (56.98, 171.1, 43.35, 222.62, 126.3, 187.65);
    
    fill(39, 170, 225);
    triangle(77, 163, 48, 203, 158, 169);
    
    fill(255, 180);
    triangle(132.6, 221, 92, 177, 204, 154); 
    
    fill (255, 200);
    triangle (56.98, 171.1, 43.35, 222.62, 126.3, 187.65);
    
    fill(122, 199, 226);
    triangle(121, 184, 177, 226, 231, 188);
    
    fill(255, 220);
    triangle(200, 145.5, 151, 221, 278, 183);
    
    fill(30, 67, 132, 140);
    triangle(147, 180, 262, 230, 203, 163);
    
    
    
    //features
    
        //eyes
    fill(0);
    triangle(391.96, 316.21, 413.86, 308.32, 440.01, 321.4);
    
    fill(180, 130, 140);
    triangle(331.78, 295.69, 335.27, 303.7, 348.63, 302.17);
    
    fill(0);
    triangle(331.78, 295.69, 343.28, 290.7, 348.63, 302.17);
    
    fill(0);
    triangle(348.63, 302.17, 343.28, 290.7, 360.7, 305.93);
    
    fill(0);
    triangle(355.2, 294.47, 343.28, 290.7, 360.7, 305.93);
       
    
        //mouth
    
    fill(190, 140, 140);
    triangle(390.92, 333.33, 335.59, 363.51, 400, 389.94);
    
    fill;
    triangle(400, 389.94, 361.67, 398.56, 351.03, 384.26)
    
    fill(78, 49, 30);
    triangle(335.59, 363.51, 335.59, 384.26, 361.67, 398.56);
    
    fill(255);
    triangle(335.59, 363.51, 400, 389.94, 351.03, 384.26);
    
    
    
        //teeth
    
    //hair
    
    fill(0);
    triangle(420.29, 192.24, 442.13, 269.25, 407.64, 216.38);
    
    fill(38, 33, 29);
    triangle(420.29, 192.24, 442.13, 269.25, 522.29, 312.93);
    
    fill(20, 20, 17);
    triangle(420.29, 192.24, 482.36, 211.78, 522.29, 312.93);
    
    fill(0);
    triangle(482.36, 211.78, 522.29, 312.93, 537.53, 269.25);
    
    fill(53, 33, 26);
    triangle(537.53, 269.25, 522.29, 312.93, 619.14, 541.67);
    
    fill(77, 37, 23);
    triangle(522.29, 312.93, 515.69, 433.62, 619.14, 541.67);
    
    fill(93, 47, 25);
    triangle(442.13, 269.25, 522.29, 312.93, 515.69, 433.62);
    
    fill(42, 18, 13);
    triangle(515.69, 433.62, 507.32, 482.99, 580.06, 500.85);
    
    fill(93, 47, 25);
    triangle(515.69, 433.62, 496.15, 473.85, 492.49, 570.4);
    
    fill(68, 40, 27);
    triangle(469.3, 329.96, 515.69, 433.62, 496.15, 473.85);
    
    fill(29, 16, 13);
    triangle(469.3, 329.96, 496.15, 473.85, 453.62, 457.76);
    
    fill(47, 21, 18);
    triangle(469.3, 329.96, 457.16, 360.83, 453.62, 457.76);
    
    fill(102, 66, 48);
    triangle(442.13, 269.25, 434.99, 290.62, 469.3, 329.96);
    
    fill(73, 50, 40);
    triangle(434.99, 290.62, 469.3, 329.96, 457.16, 360.83);
    
    fill(94, 62, 48);
    triangle(442.13, 269.25, 434.99, 290.62, 469.3, 329.96);
    
    fill(121, 75, 60);
    triangle(434.99, 302.17, 457.16, 360.83, 434.99, 290.62);
    
    fill;
    triangle(457.16, 360.83, 453.62, 457.76, 453.62, 398.56);
    
    fill;
    triangle(434.99, 290.62, 457.16, 360.83, 434.99, 290.62);
    
    fill;
    triangle(434.99, 302.17, 442.13, 329.96, 457.16, 360.83);
    
    fill(20, 20, 17);
    triangle(407.64, 216.38, 352.47, 211.78, 361.67, 230.75);
    
    fill(38, 33, 29);
    triangle(352.47, 211.78, 361.67, 230.75, 331.78, 295.69);
    
    fill(50, 24, 14);
    triangle(311.09, 338.22, 327.3, 514.91, 300.26, 581.47);
    
    fill(0);
    triangle(364.07, 440.22, 339.05, 443.49, 380.06, 502.01);
    
    fill(53, 33, 26);
    triangle(407.64, 216.38, 442.13, 269.25, 434.99, 290.62);
    
    fill;
    triangle(339.05, 443.49, 380.06, 502.01, 367.41, 524.43);
    
    fill(76, 51, 41);
    triangle(320.29, 389.94, 331.78, 593.39, 367.41, 524.43);
    
    fill;
    triangle(311.09, 338.22, 320.29, 389.94, 327.3, 514.01);
    
    fill(102, 61, 40);
    triangle(311.09, 338.22, 327.3, 514.01, 300.26, 581.47);
    
    fill(53, 33, 26);
    triangle(327.3, 514.01, 331.78, 593.39, 278.91, 634.77);
    
    fill(76, 51, 41);
    triangle(331.78, 593.39, 283.51, 649.71, 278.91, 634.77);
    
    fill(102, 61, 40);
    triangle(250.17, 641.67, 278.91, 634.77, 283.51, 649.71);
    
    fill;
    triangle(581.17, 662.36, 613.39, 689.94, 613.39, 745.11);
    
    fill(53, 33, 26);
    triangle(581.17, 662.36, 598.45, 757.76, 561.67, 788.79);
    
    
    //face
    
    fill(49, 55, 70);
    triangle(407.64, 216.38, 361.67, 230.75, 345.2, 266.53);
    
    fill(160, 100, 84);
    triangle(407.64, 216.38, 345.2, 266.53, 372.3, 266.53);
    
    fill(198, 144, 118);
    triangle(407.64, 216.38, 390.03, 292.44, 372.3, 266.53);
    
    fill(220, 165, 134);
    triangle(407.64, 216.38, 390.03, 292.44, 434.99, 290.62);
    
    fill(0);
    triangle(335.59, 433.62, 339.05, 443.49, 414.54, 433.62);
    
    fill(49, 55, 70);
    triangle(331.78, 295.69, 311.09, 338.22, 320.29, 351.44);
    
    fill;
    triangle(311.09, 338.22, 320.29, 351.44, 320.29, 389.94);
    
    fill(160, 100, 84);
    triangle(331.78, 295.69, 346.72, 329.96, 320.29, 351.44);
    
    fill(220, 165, 134);
    triangle(337.4, 308.58, 364.07, 312.93, 346.72, 329.96);
    
    fill(49, 55, 70);
    triangle(341.16, 275, 343.28, 290.7, 331.78, 295.69);
    
    fill(160, 100, 84);
    triangle(335.59, 405.46, 361.67, 398.56, 361.67, 433.62);
    
    fill(89, 52, 40);
    triangle(414.54, 433.62, 398.11, 515.26, 380.83, 448.98);
    
    fill(49, 55, 70);
    triangle(320.29, 351.44, 335.59, 363.51, 320.29, 389.94);
    
    
    fill(49, 55, 70);
    triangle(364.07, 440.22, 380.83, 448.98, 398.11, 515.26);
    
    fill;
    triangle(364.07, 440.22, 398.11, 515.26, 380.06, 502.01);
    
    fill(53, 33, 26);
    triangle(364.07, 440.22, 380.83, 448.98, 414.54, 433.62);
    
    fill(198, 144, 118);
    triangle(361.67, 398.56, 361.67, 433.62, 390.03, 433.62);
    
    fill(50, 50, 50);
    triangle(335.59, 405.46, 335.59, 433.62, 361.67, 433.62);
    
    fill(49, 55, 70);
    triangle(335.59, 363.51, 335.59, 433.62, 320.29, 389.94);
    
    fill(39, 20, 20);
    triangle(320.29, 351.44, 335.59, 363.51, 346.72, 329.96);
    
    fill(220, 165, 134);
    triangle(442.13, 329.96, 434.99, 370.69, 404.6, 374.76) ;
    
    fill(198, 144, 118);
    triangle(434.99, 370.69, 404.6, 374.76,394.03, 416.09);
    
    fill;
    triangle(442.13, 329.96, 457.16, 360.83, 453.62, 398.56);
    
    fill;
    triangle(442.13, 329.96, 453.62, 398.56, 434.99, 370.69);
    
    fill(187, 131, 98);
    triangle(434.99, 370.69, 453.62, 398.56, 394.03, 416.09);
    
    fill;
    triangle;
    
    fill(160, 100, 84);
    triangle(394.03, 416.09, 414.54, 433.62, 453.62, 398.56);
    
    fill(160, 100, 84);
    triangle(394.03, 416.09, 414.54, 433.62, 390.03, 433.62);
    
    fill(220, 165, 134);
    triangle(361.67, 398.56, 400, 389.94, 390.03, 433.62);
    
    fill;
    triangle;
    
    fill(110, 62, 40);
    triangle(400, 389.94, 404.6, 374.76, 385.6, 343.1);
    
    
    //eyebrows
    fill(80);
    triangle(390.03, 292.44, 434.99, 290.62, 434.99, 302.17);
    
    fill(50);
    triangle(364.07, 282.3, 355.2, 271.18, 341.16, 275);
    //eyebrows done
    
    
    fill(102, 61, 40);
    triangle(345.2, 266.53, 372.3, 266.53, 341.16, 275);
    
    fill(160, 100, 84);
    triangle(355.2, 271.18, 372.3, 266.53, 364.07, 282.3);
    
    fill(110, 62, 40);
    triangle(335.59, 384.26, 335.59, 405.46, 361.67, 398.56);
    
    fill(160, 100, 84);
    triangle(372.3, 266.53, 390.03, 292.44, 372.3, 308.58);
    
    fill(160, 100, 84);
    triangle(390.03, 292.44, 388.24, 312.93, 413.86, 308.32);
    
    fill(187, 131, 98);
    triangle(390.03, 292.44, 434.99, 302.17, 413.86, 308.32);
    
    fill(251, 204, 171);
    triangle(434.99, 302.17, 440.01, 321.4, 413.86, 308.32);
    
    fill;
    triangle;
    
    fill(251, 204, 171);
    triangle(442.13, 329.96, 407.64, 338.67, 404.6, 374.76);
    
    fill;
    triangle(372.3, 308.58, 385.6, 343.1, 355.2, 334.23);
    
    fill;
    triangle(385.6, 343.1, 360.37, 343.1, 389.15, 354.66);
    
    fill;
    triangle(360.37, 343.1, 362.41, 352.36, 389.15, 354.66);
    
    fill(220, 165, 134);
    triangle(453.62, 457.76, 398.11, 515.26, 496.15, 473.85);
    
    fill(187, 131, 98);
    triangle(414.54, 433.62, 453.62, 457.76, 398.11, 515.26);
    
    fill(89, 52, 40);
    triangle(453.62, 398.56, 453.62, 457.76, 414.54, 433.62);
    
    fill(198, 144, 118);
    triangle(398.11, 515.26, 369.49, 573.14, 496.15, 473.85);
    
    fill(0);
    triangle(380.06, 502.01, 398.11, 515.26, 331.78, 593.39);
    
    fill(53, 42, 48);
    triangle(398.11, 515.26, 331.78, 593.39, 369.49, 573.14);
    
    fill;
    triangle;
    
    fill(187, 131, 98);
    triangle(495.08, 502.01, 492.49, 570.4, 432.82, 627.72);
    
    fill(198, 144, 118);
    triangle(492.49, 570.4, 509.94, 600.46, 432.82, 627.72);
    
    fill(220, 165, 134);
    triangle(432.82, 627.72, 509.94, 600.46, 509.94, 690.98);
    
    fill(187, 131, 98);
    triangle(507.32, 482.99, 492.49, 570.4, 509.94, 600.46);
    
    fill(45, 40, 38);
    triangle(509.94, 600.46, 509.94, 690.98, 582.67, 666.2);
    
    fill(119, 80, 70);
    triangle(507.32, 482.99, 509.94, 600.46, 661.32, 690.98);
    
    fill(66, 47, 44);
    triangle(509.94, 600.46, 640.23, 718.23, 661.32, 690.98);
    
    fill(187, 131, 98);
    triangle(507.32, 482.99, 661.32, 634.77, 661.32, 690.98);
    
    fill(198, 144, 118);
    triangle(507.32, 482.99, 580.06, 500.85, 661.32, 634.77);
    
    fill(187, 131, 98);
    triangle(580.06, 500.85, 619.14, 541.67, 661.32, 634.77);
    
    fill(160, 100, 84);
    triangle(619.14, 541.67, 661.32, 586.84, 661.32, 634.77);
    
    fill(187, 131, 98);
    triangle(640.23, 718.23, 661.32, 690.98, 661.32, 800);
    
    fill(198, 144, 118);
    triangle(640.23, 718.23, 661.32, 800, 606.55, 800);
    
    
    //face details
    
    fill(160, 100, 84);
    triangle(341.16, 275, 364.07, 282.3, 343.28, 290.7);
    
    fill(187, 131, 98);
    triangle(364.07, 282.3, 369.28, 298.93, 343.28, 290.7);
    
    fill(66, 47, 44);
    triangle(364.07, 282.3, 372.3, 295.69, 372.3, 308.58);
    
    fill(119, 80, 70);
    triangle(372.3, 266.53, 372.3, 295.69, 364.07, 282.3);
    
    fill(198, 144, 118);
    triangle(387.31, 323.56, 385.6, 343.1, 442.13, 329.96);
    
    fill(220, 165, 134);
    triangle(385.6, 343.1, 407.64, 338.67, 404.6, 374.76);
    
    fill(255, 214, 191);
    triangle(390.03, 292.44, 372.3, 308.58, 385.6, 343.1);
    
    fill(198, 144, 118);
    triangle(355.2, 294.47, 369.28, 298.93, 364.07, 312.93);
    
    fill(240, 185, 164);
    triangle(355.2, 334.23, 350.73, 343.1, 385.6, 343.1);
    
    fill(49, 55, 70);
    triangle(346.72, 329.96, 350.73, 343.1, 341.16, 346.73);
    
    fill;
    triangle(346.72, 329.96, 355.2, 334.23, 350.73, 343.1);
    
    fill;
    triangle(346.72, 329.96, 355.2, 334.23, 364.07, 312.93);
    
    fill(119, 80, 70);
    triangle(369.28, 298.93, 372.3, 308.58, 364.07, 312.93);
    
    fill(49, 55, 70);
    triangle(364.07, 312.93, 372.3, 308.58, 355.2, 334.23);
    
    fill(119, 80, 70);
    triangle(337.4, 308.58, 364.07, 312.93, 335.27, 303.7);
    
    fill;
    triangle(350.48, 308.58, 360.7, 305.93, 364.07, 312.93);
    
    fill;
    triangle(335.27, 303.7, 350.48, 308.58, 360.7, 305.93);
    
    fill;
    triangle(348.63, 302.17, 335.27, 303.7, 360.7, 305.93);
    
    fill;
    triangle(388.24, 312.93, 391.96, 316.21, 413.86, 308.32);
    
    fill;
    triangle(388.24, 312.93, 402.29, 325.31, 387.31, 323.56);
    
    fill;
    triangle(391.96, 316.21, 418.48, 327.2, 402.29, 325.31);
    
    fill;
    triangle(440.01, 321.4, 442.13, 329.96, 418.48, 327.2);
    
    fill(240, 185, 164);
    triangle(391.96, 316.21, 418.48, 327.2, 440.01, 321.4);
    
    
    
    //nose and mouth details
    fill(49, 55, 70);
    triangle(341.16, 346.73, 363.75, 358.47, 350.73, 343.1);
    
    fill(189, 130, 100);
    triangle(350.73, 343.1, 360.37, 343.1, 363.75, 358.47);
    
    fill(198, 144, 118);
    triangle(374.76, 353.42, 378.1, 358.47, 389.15, 354.66);
    
    fill(40);
    triangle(362.41, 352.36, 374.76, 353.42, 363.75, 358.47);
    
    fill(40);
    triangle(378.1, 358.47, 374.76, 353.42, 363.75, 358.47);
    
    fill(40, 30, 30);
    triangle(341.16, 346.73, 335.59, 363.51, 363.75, 358.47);
    
    fill(189, 130, 100);
    triangle(335.59, 363.51, 349.67, 367.65, 350.96, 360.76);
    
    fill(198, 144, 118);
    triangle(350.96, 360.76, 349.67, 367.65, 363.75, 358.47);
    
    fill;
    triangle(349.67, 367.65, 363.75, 358.47, 358.29, 372.24);
    
    fill;
    triangle(363.75, 358.47, 358.29, 372.24, 367.41, 370.69);
    
    fill;
    triangle(363.75, 358.47, 367.41, 370.69, 378.1, 358.47);
    
    fill(220, 184, 168);
    triangle(378.1, 358.47, 367.41, 370.69, 390.92, 376.9);
    
    fill(230, 210, 198);
    triangle(378.1, 358.47, 400, 389.94, 389.15, 354.66);
    
    
    
    //inner clothes
    
    fill(21, 24, 29);
    triangle(283.51, 649.71, 266.84, 707.52, 319.19, 800) ;
    
    fill(40, 41, 39);
    triangle(283.51, 649.71, 319.19, 800, 356.28, 627.72);
    
    fill(10, 10, 10);
    triangle(283.51, 649.71, 356.28, 627.72, 331.78, 593.39);
    
    fill(70, 65, 59);
    triangle(356.28, 627.72, 319.19, 800, 391.96, 745.11);
    
    fill(40, 41, 30);
    triangle(331.78, 593.39, 356.28, 627.72, 496.15, 473.85);
    
    fill(70, 65, 59);
    triangle(356.28, 627.72, 432.82, 627.72, 496.15, 473.85);
    
    fill(40, 41, 30);
    triangle(495.08, 502.01, 496.15, 473.85, 432.82, 627.72);
    
    fill;
    triangle(391.96, 745.11, 319.19, 800, 495.08, 800);
    
    fill(76, 67, 60);
    triangle(391.96, 745.11, 495.08, 800, 509.94, 690.98);
    
    fill(30, 31, 29);
    triangle(509.94, 690.98, 582.67, 666.2, 495.08, 800);
    
    fill(10, 10, 10);
    triangle(582.67, 666.2, 567.441, 800, 495.08, 800);
    
    fill(89, 85, 80);
    triangle(432.82, 627.72, 356.28, 627.72, 391.96, 745.11);
    
    fill(71, 68, 64);
    triangle(391.96, 745.11, 509.94, 690.98, 432.82, 627.72);
    
    
    fill(0);
    triangle(400.11, 308.58, 391.96, 316.21, 413.86, 308.32);
}



For this project, I attempted to create a cubist-style self portrait. I wanted to make it look as realistic as possible, but I realized that with the little set of skills that I have at the moment, the only way to do so was to create small areas of different colors using triangles, which I thought would be more appropriate than rectangles or quadrilaterals in depicting small details and color differences among the features.

It was not so hard to write the program since the code consisted mostly of triangles, but it was rather difficult to assign each of them the right color and the appropriate size.

I also made the sun to change its size as a little experiment of what I learned in the lecture today.

kyungak-project-01-Face

kyungak-self-portrait

//Kyunga Ko, 15104E, kyungak@andrew.cmu.edu, Project-01

function setup() {
    createCanvas(500, 675);
    background(230,157,157);
}

function draw() {

    fill(0);
    noStroke();
    quad(0,100,270,70,250,230,0,300);
    quad(270,70,370,400,270,440,250,230);
    quad(350,370,370,400,160,600,0,500);
    //hair

    fill(169,181,223);
    stroke(37);
    arc(0,530,330,730,0,HALF_PI);
    //body

    fill(232,197,162);
    rotate(PI/7);
    stroke(37);
    ellipse(250,260,330,430);
    //face

    fill(227,72,80);
    noStroke();
    triangle(234,300,249,260,263,300);
    //nose

    noFill();
    stroke(227,103,36);
    strokeWeight(10);
    arc(240,350,50,30,3*PI/2,PI/2);
    arc(240,380,50,30,3*PI/2,PI/2);
    //mouth

    fill(237,195,127);
    ellipse(180,237,70,110);
    //left eye

    fill(237,195,127);
    ellipse(320,237,70,110);
    //right eye

    fill(36,35,40);
    noStroke();
    ellipse(320,245,30,70);
    //right eye pupil

    fill(36,35,40);
    noStroke();
    ellipse(180,245,30,70);
    //left eye pupil

    fill(227,103,36);
    rotate(PI/17);
    rect(165,140,100,30);
    //left lower part of eyelid

    fill(227,103,36);
    rotate(PI/270);
    arc(190, 145, 100, 100, PI+QUARTER_PI, TWO_PI);
    //left upper part of eyelid

    fill(227,103,36);
    rotate(PI/270);
    rect(310,115,100,30);
    //left lower part of eyelid

    fill(227,103,36);
    rotate(PI/270);
    arc(340, 118, 100, 100, PI+QUARTER_PI, TWO_PI);
    //left upper part of eyelid


}

 

Although the face does not exactly synchronize the way I look, I took an artistic approach and experimented with the shapes to produce a self portrait. It was interesting to work and learn about the different features of javascript.

Sheenu-Project-01-Face

sketch

function setup() {
    createCanvas(600, 600);
    background(255);
}

function draw() {
	//%60 More handsome Sheenu
	noStroke();

	//Awesome Background
	fill(44,86,159)
	ellipse(300, 300, 550, 550);

	//Neck
	fill(202, 153, 101);
	triangle(391, 203, 300, 1000, 190, 203);

	//Shirt
	fill(255);
	arc(290, 550, 400, 300, PI, 0, CHORD);

	//NeckCollar
    fill(202, 153, 101);
	ellipse(293, 400, 148, 130);	

	//Hair BACK
	fill(16,38,77);
	rect(160, 90, 263, 240, 60);

	//Head
    fill(222,182,139);
	rect(172, 116, 240, 240, 60);
	triangle(393, 340, 300, 400, 191, 340);
	strokeWeight(35);
	stroke(224, 141, 90);
	line(220,253,360,253);
	stroke(0);
	noStroke();


	//Hair FRONT
	fill(16,38,77);
    quad(183, 116, 400, 116, 410, 150, 169, 180);
    triangle(160, 150, 170, 300, 190, 160);
    triangle(370, 130, 420, 270, 420, 150);
    triangle(160,180, 230, 140, 260, 200);

    //Random Rectangle that Hides Stuff
    fill(255);
    rect(1,550,450,600);

    //Ears
    fill(222,182,139);
    ellipse(175, 250, 50, 70);
    ellipse(407, 250, 50, 70);

    //FACE

    //Eyes
    stroke(5, 19, 46);
    strokeWeight(20);
    line(200, 220, 260, 220);
    line(320, 220, 380, 220);
    strokeWeight(5);
    line(220, 250, 260, 250);
    line(320, 250, 360, 250);
    strokeWeight(20);
    fill(5, 19, 46);
    ellipse(250,260,1,1);
    ellipse(350,260,1,1);

    //Nose
    noStroke();
    fill(202, 153, 101);
    triangle(323, 310, 295, 330, 261, 310);

}

 

This project was really fun and also perfectly challenging. I am really happy with the way this turned out visually, especially since I made this %60 more good looking than me in reality. I tried using Photoshop to help me guide the coordinates for these shapes, but for some reason they did not match and the codes for Photoshop would put shapes in different places in the .js code. Making this face mostly took trial and error and took me a lot of time discovering and learning how to use new shapes like lines, triangle, and other complicated shapes. Other than that, this was pretty good and fun.

aerubin-Project-01-Face

sketch

//Angela Rubin
//Section C
//aerubin
//Assignment-01

function setup() {
    createCanvas(500, 500);
    background(220, 248, 244);
    angleMode(DEGREES); 
}

function draw() {

    //Hair
    strokeWeight(0);
    fill(64, 30, 5);
    rect(140, 175, 220, 300);

    //Shirt
    if(mouseIsPressed) {
        fill(255, 254, 56);
    } 
    else {
        fill(247, 219, 223);
    }
    
    rect(207, 390, 86, 110);

    arc(220, 570, 270, 315, 180, 310, CHORD);

    arc(280, 570, 270, 315, 200, 330, CHORD);

    //Neck
    strokeWeight(0);
    fill(235, 210, 195);
    rect(207, 320, 86, 105);

    arc(250, 420, 86.6, 79, 0, 180, CHORD);

    //Face
    strokeWeight(1);
    stroke(225,198,208);
    fill(231, 212, 199);
    triangle(250, 250, 325, 350, 250, 400);

    fill(234, 211, 197);
    triangle(250, 250, 175, 350, 250, 400);

    fill(235, 210, 195);
    triangle(250, 250, 175, 350, 150, 250);

    fill(233, 214, 200);
    triangle(250, 250, 325, 350, 350, 250);

    fill(235, 210, 193);
    triangle(250, 250, 340, 175, 350, 250);

    fill(231, 212, 199);
    triangle(250, 250, 160, 175, 150, 250);

    fill(233, 209, 195);
    arc(250, 250, 225, 247, 220, 320, PIE);

    //Facial Features
    strokeWeight(4);
    stroke(0, 0, 0);
    noFill();
    arc(200, 268, 60, 60, 220, 320);

    noFill();
    arc(300, 268, 60, 60, 220, 320);

    noFill();
    arc(250, 300, 90, 80, 0, 180, CHORD);

    line(250, 250, 265, 270);
    line(265, 270, 250, 270);

    //Bangs
    strokeWeight(0);
    fill(64, 30, 5);
    arc(315, 130, 220, 180, 50, 180, CHORD);

    arc(250, 268, 270, 315, 220, 320, CHORD);

    arc(165, 160, 120, 65, 0, 110, CHORD);

    rect(150, 175, 39, 15);

    rect(310, 175, 40, 20);

    //Arm Lines
    strokeWeight(2.5);
    line(168, 483, 168, 500);
    line(332, 483, 332, 500);

    //Bobby Pins
    strokeWeight(3);
    stroke(247, 219, 223);
    line(332, 160, 315, 183);
    line(323, 152, 306, 175);
}

This project really challenged my creativity as I do not normally picture simple shapes forming the basis of a human face. I began forming ideas by drawing faces on paper and experimenting with different shapes. Eventually, I came to the conclusion that triangles could be a viable option to draw the initial structure of the head. Instead of making the triangles the same color and no outline, I thought it would be interesting if each triangle was a slightly different shade than the adjacent ones to add an element of abstractness. I then added the rest of the features of the face, hair, and clothing. In addition, the shirt changes color when the mouse is clicked. I am very happy with the product and it was really enjoyable to create!

karinac-Project-01

karinac-portrait

function setup() {
	createCanvas(500,600);
	background(172,214,234);
	}

function draw() {
	//hair
	stroke(25,0,0);
	strokeWeight(10);
	fill(40,0,0);
	arc(225,250,300,250,PI,PI);
	rect(75,250,300,300);

	//shirt
	noStroke();
	fill(250,242,140);
	rect(100,525,250,125);
	stroke(150,150,150);
	strokeWeight(3);
	arc(225,525,250,150,PI,PI);

	//neck
	stroke(194,141,109);
	strokeWeight(4);
	fill(207,165,141);
	rect(175,400,108,70);
	stroke(150,150,150);
	strokeWeight(7);
	fill(207,165,141);
	arc(229,460,112,140,0,PI);

	//face
	stroke(194,141,109);
	strokeWeight(5);
	fill(207,165,141);
	ellipse(225,300,250,275);

	//left eye
	noStroke();
	fill(250,250,250);
	ellipse(170,310,50,50);
	fill(30,0,0);
	ellipse(175,305,35,35);

	//right eye
	noStroke();
	fill(250,250,250);
	ellipse(281,310,50,50);
	fill(30,0,0);
	ellipse(286,305,35,35);

	//left eyebrow
	noFill();
	stroke(0);
	strokeWeight(3);
	arc(170,275,60,10,PI,PI);

	//right eyebrow
	noFill();
	stroke(0);
	strokeWeight(3);
	arc(280,275,60,10,PI,PI);

	//nose
	noStroke();
	fill(194,141,109);
	triangle(200,365,225,320,250,365,20);

	//smile
	stroke(0);
	strokeWeight(2);
	fill(250,250,250);
	arc(225,380,110,80,0,PI);
	line(170,380,280,380);


	//headphones
	noFill();
	stroke(165,10,10);
	strokeWeight(20);
	arc(225,303,315,372,PI,PI);
	stroke(110,10,10);
	strokeWeight(35);
	arc(225,170,220,90,PI,PI);
	line(65,275,65,355);
	line(385,275,385,355);
	noStroke();
	fill(165,10,10);
	rect(30,265,40,100,30);
	rect(380,265,40,100,30);
	stroke(250,250,250);
	strokeWeight(5);
	line(65,372,65,405);
	line(65,405,85,415);
	line(85,415,55,435);
	line(55,435,85,460);
	line(85,460,55,485);
	line(55,485,85,492);
	line(85,492,85,600);

	//music note
	fill(0);
	stroke(0);
	strokeWeight(5);
	line(420,92,420,137);
	line(390,95,390,140);
	strokeWeight(6);
	line(390,95,420,92);
	strokeWeight(5);
	ellipse(380,140,20,10);
	ellipse(410,138,20,10);
	strokeWeight(3);
	line(457,25,457,60);
	ellipse(450,60,15,8);
	
	//hair-top
	fill(40,0,0);
	stroke(34,0,0);
	strokeWeight(3);
	rotate(QUARTER_PI-.13);
	ellipse(270,95,90,230);


}

I knew from the beginning that in addition to coding a self-portrait I wanted to display something that represented who I am.  So naturally, even though it took extra time and effort, I had to include the headphones since music has always been a huge part of my life.

The most challenging ad time-consuming feature was the front bangs of the hair layered on top of the headphones. The process consisted of a lot of trial and error as I struggled with the orientation of the ellipse.

Overall, I learned a lot through this process and I’m happy with how it turned out.

aboyle-Project01-Face

Anna-Face

//Anna Boyle
//Section D
//aboyle@andrew.cmu.edu
//Assignment-01

function setup() {
    createCanvas(350, 350);
    background(166,242,252);

    strokeWeight(0)

//hair color-back
    fill(81,58,30)
    ellipse(230,220,95,100)
    fill(81,58,30)
    ellipse(120,90,120)
    ellipse(115,150,110)
    ellipse(110,200,110)

//clothing color
    fill(38,112,51)
    ellipse(160,275,180,120)

//skin color
    fill(241,197,137)
    ellipse(149,100,120,120)
    ellipse(149,150,115,115)
    rect(140,190,45,50)

//blush
    fill(244,156,103)
    rect(94,130,70,20,0,20,20,20)

//hair color-front
    fill(81,58,30)
    ellipse(170, 55, 100, 60)
    ellipse(210,100,95,100)
    ellipse(220,180,95,100)

    strokeWeight(9)
    noFill()

//face
    curve(160, 20, 150, 207, 95, 138, 300, 0);
    curve(100, 100, 120, 50, 95, 130, 300, 290);

//eyes
    line(110,112,110,128)
    line(135,112,135,128)

//hair lines
    curve(350,280,137,34,68,123,350,350)
    curve(150,150,68,123,65,170,150,150)
    curve(200,200,65,170,77,245,200,200)
    curve(200,100,137,34,220,50,300,300)
    curve(0,100,220,50,245,135,50,200)
    curve(150,125,245,135,270,190,210,250)
    curve(100,100,270,190,253,263,200,125)
    curve(280,0,120,50,175,80,200,0)
    curve(350,0,168,83,200,145,220,0)

//clothing lines
    stroke(22,65,29)
    line(102, 280, 102, 315)
    line(200, 280, 200, 323)
    curve(100,100,125,230,195,227,120,120)

//hair line
    stroke(0)
    curve(350,50,185,149,240,220,630,0)

//face
    strokeWeight(5)
    curve(200,140,120,140,120,150,200,150)
    curve(100,100,115,170,135,170,120,120)
    curve(100,130,102,105,120,100,100,140)
    curve(150,130,129,100,147,105,120,140)
}

I thought this assignment was pretty cool! The project description included a picture of Tintin, which inspired me to use bold, black lines in my drawing. It was a lot of trial and error for me, but I enjoyed the process a lot. I had fun with the curve function, as you can probably tell. I also learned very quickly that it helps to separate your code and comment what each section is for.

I had one little hiccup with noStroke() affecting later lines, but I changed it to strokeWeight(0) and that worked out a lot better. I also meant to have a bigger canvas, but by the time I realized my canvas was set to (350, 350) it would’ve been a ludicrous amount of extra work to go back and adjust everything accordingly. Overall I’m pretty happy with how it turned out.

eeryan-Project 1 self portrait

sketch

function setup() {
    createCanvas(500, 600);
    background(247,187,31);
}

function draw() {
    //hair
    strokeWeight(0);
    fill(137,60,29);
    ellipse(240,280,300,300)
    strokeWeight(0);
    fill(137,60,29);
    ellipse(185,350,290,310);
    strokeWeight(0);
    fill(137,60,29);
    ellipse(300,360,280,270);
    //face
    strokeWeight(0);
    fill(234,179,125);
    ellipse(250,300,250,260);
    //body
    strokeWeight(0);
    fill(141,214,239);
    ellipse(230,580,355,240);
    //cheeks
    strokeWeight(0);
    fill(250,178,125);
    ellipse(187,305,75,75);
    strokeWeight(0);
    fill(250,178,125);
    ellipse(328,305,75,75);
    //eyes
    strokeWeight(0);
    fill(137,60,29);
    ellipse(220,273,20,15);
    strokeWeight(0);
    fill(137,60,29);
    ellipse(308,273,20,15);
    //nose
    strokeWeight(0);
    fill(244,151,89);
    rect(258,265,23,80);
    //mouth
    stroke(234,125,92);
    strokeWeight(5);
    noFill();
    line(230,370,290,370);
}

Process:

I started by mocking up my self portrait in Illustrator, to figure out the shapes and colors that would work best for this assignment. I found it easier to rough it out in Illustrator and in my sketchbook as opposed to diving in with code without first planning out how I wanted it to look. After I figured out the way I generally wanted it to look in Illustrator, I used the ruler function to find the x and y coordinates for each shape to insert into my code. Once I had coded everything to the exact coordinates that I had in Illustrator, I further tweaked some of the facial elements to get everything the way I wanted. I messed around with adding colored strokes to certain elements, as well as adding a neck, but decided in the end to keep to simple, rounded shapes to unify the composition.

JackieChou-project 01-face

sketch 2

//Jackie Chou
//Section E
//jwchou@andrew.cmu.edu
//Project-01
function setup() {
    createCanvas(600, 585);
    background(251,220,13);
    text("p5.js vers 0.5.12 test.", 10, 15);
}

function draw() {
	

	//neck
	noStroke();
	fill(211,166,161);
	rect(255,400,90,100);

	//head
	fill(224,195,200);
	ellipse(300,300,200,240);

	//hat
	fill(60);
	arc(300,240,170,150,PI,0);
	fill(0);
	ellipse(300,160,20,20);

	//face shape
	fill(251,220,13);
	quad(200,300,250,430,200,400,200,300);
	quad(400,300,350,430,400,400,400,300);

	//ears
	fill(224,195,200);
	ellipse(210,290,50,60);
	ellipse(390,290,50,60);

	//mask
	fill(20);
	rect(210,255,179,65);

	//masksides
	arc(210,287,33,64,HALF_PI,PI+HALF_PI);
	arc(389,287,33,64,PI+HALF_PI,HALF_PI);

	//maskholes
	fill(211,166,161);
	ellipse(263,283,45,35);
	ellipse(343,283,45,35);

	//maskholes
	fill(224,195,200);
	ellipse(258,283,45,35);
	ellipse(338,283,45,35);

	//eyes
	fill(245);
	ellipse(259,281,30,15);
	ellipse(341,281,30,15);
	fill(3);
	ellipse(252,281,10,10);
	ellipse(334,281,10,10);

	//mouth2
	stroke(173,140,137);
	strokeWeight(5);
	line(270,370,330,370);

	//nose
	noStroke();
	fill(211,166,161);
	arc(300,337,30,10,0,PI);


	//nose
    noFill();
	strokeWeight(3);
	stroke(136,104,101);
	noStroke();
	beginShape();
	curveVertex(300,290);
	curveVertex(297,290);
	curveVertex(315,320);
	curveVertex(292,322);
	curveVertex(293,310);
	endShape();
	noStroke();

	//shirt
	fill(50);
	ellipse(300,584,370,270);
	noFill();
	beginShape();
	vertex(70,600);
	vertex(150,515);
	vertex(255,475);
	vertex(345,475);
	vertex(450,515);
	vertex(530,600);
	endShape(CLOSE);

	//shirt-stripes
	fill(210);
	rect(170,500,260,10);
	rect(145,530,300,10);
	rect(135,560,330,10);



}

Robber, 2017
Digital self portrait.
Javascript.

For this project, I went through multiple iterations and phases. The toughest part was learning first how to utilize the different commands to create the shapes I wanted to use. Also, I didn’t learn how to organize my code until late in the process, which made managing my code harder. However, I picked everything up fairly quickly.

I also experimented and iterated how I wanted to represent my nose and my mouth.

I first went from a generic self portrait:

To a robber (I don’t know why, but I felt that it represented me).

sntong-Project 01 – Face

sketch

//Scarlet Tong 
//
function setup() {
    createCanvas(600, 600);
    background(254);

}

function draw() {
    //hair
    var c = color(0,0,0);
    fill (c);
    noStroke();
    rect (105,184,382,350);
    ellipse(296,195,382,282);

    //clothes
    var c = color (171,229,255);
    fill (c);
    noStroke();
    rect(140,483,319,170,25,25,0,0);//tee


    //face and neck
    var c = color (255,204,188);
    fill(c);
    rect(170,193,255,260,0,0,140,140);//face
    noStroke();
    rect (267,420,63,80);//neck
    rect (238,483,120,49,0,0,20,20);//collar

    var b = color(0,0,0);//eyes, noses, lips
    fill(b);
    ellipse(245,275,13,23);
    ellipse(354,275,13,23);
    noFill();
    stroke(0);
    strokeWeight(5);
    line(294,316,294,335);
    line(294,335,305,340);
    strokeCap(SQUARE);
    arc(300,400,30,25,0,PI);

    stroke (255,96,97);//glasses 
    strokeWeight(10);
    strokeCap(ROUND);
    line(204,246,280,246);
    line(280,246,280,300);
    line(204,300,280,300);
    line(204,246,204,300);
    line(320,246,396,246);
    line(396,246,396,300);
    line(320,300,396,300);
    line(320,246,320,300);
    line(170,270,204,270);
    line(280,270,320,270);
    line(396,270,425,270);








}

This is my first coding assignment and working with Java Script. I believe the Mondrian assignment was a nice jump start for me to get used to the coding language and the formatting. I relied on the online reference to help me on the assignment.