Lauren Park-Category Project-02-Variable-Face

sketch 

var eyeSize = 20;
var eyebrowSize = 30;
var noseWidth = 40;
var noseHeight = 40;
var faceWidth = 230;
var faceHeight = 250;
var mouthX = 60;
var mouthY = 30;
var hair = 40;
var hairColorX = '#F5CF58';
var hairColorY = '#FF8D80';
var hairColorZ = '#91D6FA';
var colorFaceX = '#D9BB96';
var colorFaceY ='#387178';
var colorFaceZ = '#D2F58C';

 
function setup() {
    createCanvas(640, 480);
}
 
function draw() {
    background('#A1C556');
    strokeWeight(0);
  
    //hair
    fill(hairColorX, hairColorY, hairColorZ);
    ellipse(width / 2, height / 2+10, hair*5, hair*7);
    ellipse(width / 2, height / 2+10, hair*7, hair*5);
    
    
    strokeWeight(1);
    fill(colorFaceX,colorFaceY,colorFaceZ);
    ellipse(width / 2, height / 2, faceWidth,  faceHeight);
  
    //eyes
    fill(250);
    ellipse(width / 2-60, height / 2, eyeSize+15, eyeSize);
    ellipse(width / 2+60, height / 2, eyeSize+15, eyeSize);
  
    fill(50);
    ellipse(width / 3+47, height / 3+80, eyeSize+5, eyeSize);
    ellipse(width / 3+166, height / 3+80, eyeSize+5, eyeSize);
  
    //nose
    fill(colorFaceX,colorFaceY,colorFaceZ);
    arc(315, 255, noseWidth, noseHeight-5, 0, HALF_PI);
    
    //eyebrow
    noFill();
    strokeWeight(2);
    arc(380, 220, eyebrowSize, eyebrowSize, PI + QUARTER_PI,       TWO_PI);
    arc(255,220, eyebrowSize, eyebrowSize, PI, PI+HALF_PI+QUARTER_PI);
   
    //mouth
  fill('#76301C');
  strokeWeight(0);
    ellipse(width / 3+105, height / 3+150, mouthX, mouthY);
  
  
    
}
 
function mousePressed() {

    // 'faceWidth' gets a random value between 75 and 150.
    faceWidth = random(200, 275);
    faceHeight = random(200, 300);
    eyeSize = random(10, 30);
    noseWidth = random(30, 50);
    noseHeight = random(30,50);
    eyebrowSize = random(30,60);
    mouthX = random(30,60);
    mouthY = random(30,60);
    colorFaceX = random(102,245);
    colorFaceY = random(115, 250);
    colorFaceZ = random(100, 200);
    hair = random(50,70);
    hairColorX = random(145,214);
    hairColorY = random(255, 141);
    hairColorZ = random(245, 211);
}

For this project, I was trying to create a similar expression on different facial forms and I wanted to place these expressions on a face shaped like a flower. It was very interesting but challenging to try and play around with the different colors and fitting the shapes proportionally and randomizing them by each click.

Xu Xu – Project 02 – Variable Face

I enjoyed creating this face, and the mouse-press was really fun to work with. However, since I created a relatively detailed face (less abstract), it was hard for me to change the face shape or hair shape because I had so many points (Originally I wanted to do a face where the hair would seem as if wind was blowing on them, but I soon realized that it was too hard). If I were to do this project again, I would instead do a simplified face that would create more variations.

sketch

var glassesColour = 193;
var glassesRim = 255;
var glassesSizeX = 15;
var glassesSizeY = 55;
var strandX = 208;
var strandY = 20;
var eyebrowX = 180;
var eyebrowY = 198;
var collarColor = 134
var mouth = 53;
function setup() {
    createCanvas(480, 640);
	
}

function draw() {
    background(199,184,103);
//face
    noStroke();
    fill(227,200,170);
    beginShape();
    vertex(130,114);
    vertex(126,123);
    vertex(122,131);
    vertex(111,164);
    vertex(110,179);
    vertex(112,195);
    vertex(108,149);
    vertex(111,203);
    vertex(99,224);
    vertex(78,246);
    vertex(74,253);
    vertex(77,262);
//beginning of lips
    vertex(88,270);
    vertex(83,275);
    vertex(76,282);
    vertex(73,285);
    vertex(77,292);
    vertex(87,297); //beg
    vertex(82,299);
    vertex(76,303);
    vertex(74,309);
    vertex(75,314);
    vertex(84,313);
//end of lips
    vertex(85,323);
    vertex(79,333);
    vertex(78,344);
    vertex(86,351);
    vertex(102,356);
    vertex(123,357);
    vertex(177,343);
    endShape(CLOSE);
//neck
    noStroke();
    fill(227,200,170);
    beginShape();
    vertex(116,359);
    vertex(120,340);
    vertex(134,366);
    vertex(171,424);
    vertex(239,376);
    vertex(216,323);
    vertex(200,250);
    endShape(CLOSE);
//head
    fill(227,200,170);
    ellipse(225,210,200,200);
//glasses
    strokeWeight(4);
    stroke(glassesRim,189,189);
    line(174,229,125,216);
    line(111,213,105,210);
    fill(170,170,glassesColour);
    ellipse(120,225,glassesSizeX,glassesSizeY);
    noFill();
    strokeWeight(2);
    stroke(glassesRim,189,189);
    ellipse(120,225,glassesSizeX,glassesSizeY);
//body
    noStroke();
    fill(collarColor + 30, 32, 78);
    beginShape();
    vertex(145,640);
    vertex(135,591);
    vertex(137,548);
    vertex(146,470);
    vertex(163,459);
    vertex(208,430);
    vertex(305,453);
    vertex(361,502);
    vertex(393,550);
    vertex(416,603);
    vertex(430,640);
    endShape(CLOSE);
    noStroke();
    fill(collarColor, 32, 78);
    beginShape();
    vertex(163,400);
    vertex(154,406);
    vertex(156,446);
    vertex(193,452);
    vertex(253,454);
    vertex(293,462);
    vertex(286,427);
    vertex(268,413);
    endShape(CLOSE);
    noStroke();
//mouth
	noStroke();
	fill(mouth,0,37);
	beginShape();
	vertex(89,297);
	vertex(76,282);
	vertex(73,285);
	vertex(77,292);
	vertex(87,297); //beg
	vertex(82,299);
	vertex(76,303);
	vertex(74,309);
	vertex(75,314);
	vertex(84,313);
	endShape(CLOSE);
//hair
    noStroke();
    fill(70,0,0);
    beginShape();
    vertex(117,126);
    vertex(110,140);
    vertex(103,159);
    vertex(100,181);
    vertex(107,200);
    vertex(105,179);
    vertex(109,156);
    vertex(118,139);
    vertex(115,161);
    vertex(125,178);
    vertex(140,197);
    vertex(150,210);
    vertex(158,226);
    vertex(160,201);
    vertex(167,224);
    vertex(180,247);
    vertex(189,275);
    vertex(191,296);
    vertex(185,325);
    vertex(183,358);
    vertex(184,378);
    vertex(187,395);
    vertex(193,417);
    vertex(206,434);
    vertex(218,441);
    vertex(236,442);
    vertex(260,440);
    vertex(280,452);
    vertex(294,470);
    vertex(340,539);
    vertex(363.580);
    vertex(372,568);
    vertex(394,539);
    vertex(410,519);
    vertex(427,508);
    vertex(442,491);
    vertex(449,473);
    vertex(460,476);
    vertex(444,433);
    vertex(410,351);
    vertex(381,237);
    vertex(371,187);
    vertex(346,135);
    vertex(315,111);
    vertex(275,92);
    vertex(243,85);
    vertex(222,84);
    vertex(189,89);
    vertex(180,87);
    vertex(165,92);
    endShape(CLOSE);
//strand of hair
    noStroke();
    fill(70,0,0);
    beginShape();
    vertex(222,90);
    vertex(strandX,43);
    vertex(229,strandY);
    vertex(215,50);
    endShape(CLOSE);
//eyebrows
    strokeWeight(3);
    stroke("black");
    line(118,eyebrowX,150,eyebrowY);
}

function mousePressed() {
    // when the user clicks, these variables are reassigned
    // to random values within specified ranges. For example,
    // 'faceWidth' gets a random value between 75 and 150.
    glassesRim = random(100,255);
    glassesColour = random (106,230);
    glassesSizeX = random(10,20);
    glassesSizeY = random (45,65);
    eyebrowX = random (175, 198);
    eyebrowY = random (175, 198);
    strandX = random (200,210);
    strandY = random (15,50);
    collarColor = random (0,134);
    mouth = random(53,255);
}

Gretchen Kupferschmid – Project 02 – Variable Face


sketch

var eyeSize = 7.588;
var mouthWidth = 20.166;
var mouthHeight = 17.656; 
var flowerSize = 226.69;
var flowerColor = 208;
var blushHeight = 5.565;
var cactusHeight = 217;
var cactusArm = 75.357;
var cactusColor = 119; 

function setup() {
    createCanvas(480, 640);
}
 function draw (){
    background(199, 241, 242);
    
    //ground
    fill(193, 173, 139);
    noStroke();
    rect(0, 359.79, 480, 280.209);
    
    //ground shadow
    fill(142, 123, 94);
    noStroke();
    ellipse(142.96, 426.9, 217.735, 29.888);
     
    //cactus shadow
    fill(93, 135, 56);
    noStroke();
    ellipse (209.98, 426.9, 80.461, 37.36);
    beginShape();
    curveVertex (209.16, 437.58);
    curveVertex (170, 430.95);
    curveVertex (167.32, 397.88);
    curveVertex (164.59, 363.31);
    curveVertex (156, 248.85);
    curveVertex (173, 148.38);
    curveVertex (224, 131.63);
    curveVertex (262, 204.89);
    curveVertex (262, 303.27);
    curveVertex (251, 392.23);
    curveVertex (248, 430.95);
    curveVertex (209.16, 437.58);
    endShape();
    beginShape();
    curveVertex (189, 359.09);
    curveVertex (171, 358.09);
    curveVertex (145, 352.09);
    curveVertex (113, 337.09);
    curveVertex (88, 272.09);
    curveVertex (112, 247.09);
    curveVertex (137, 268.09);
    curveVertex (189, 317.09);
    curveVertex (189, 359.09);
    endShape();
    beginShape();
    curveVertex (233, 294.73);
    curveVertex (231, 260.73);
    curveVertex (255.96, 226.97);
    curveVertex (278, 204.73);
    curveVertex (308, 192.73);
    curveVertex (334, 219.73);
    curveVertex (312, 272.73);
    curveVertex (275, 297.73);
    curveVertex (252.77, 301.71);
    curveVertex (233, 294.73);
    endShape();
     
    //cactus main body
    fill(cactusColor, 173, 78);
    noStroke();
    beginShape();
    curveVertex (217.38, 430.71);
    curveVertex (184.74, 422.24);
    curveVertex (179.02, 340.31);
    curveVertex (172.99, 248.24);
    curveVertex (187.26, 152.24);
    curveVertex (230.06, 136.24);
    curveVertex (261.96, 206.24);
    curveVertex (261.96, 300.24);
    curveVertex (252.72, 385.24);
    curveVertex (250.21, 423.24);
    curveVertex (217.38, 430.71);
    endShape();
    beginShape();
    curveVertex (189, 350);
    curveVertex (171, 349);
    curveVertex (152.15, 345.15);
    curveVertex (145, 343);
    curveVertex (113, 328);
    curveVertex (93.55, 304.65);
    curveVertex (88, 263);
    curveVertex (112, 238);
    curveVertex (137, 259);
    curveVertex (182.98, 298.1);
    curveVertex (189, 308);
    curveVertex (197.95, 333.5);
    curveVertex (189, 350);
    endShape()
    beginShape();
    curveVertex (239, 274);
    curveVertex (237, 240);
    curveVertex (261.96, 206.24);
    curveVertex (284, 184);
    curveVertex (314, 172);
    curveVertex (340, 199);
    curveVertex (318, 252);
    curveVertex (281, 277);
    curveVertex (260.25, 280.94);
    curveVertex (239, 274);
    endShape();
    ellipse (114.46, 276.75, 57, 79.492);
    ellipse (307.36, 209.41, 67.402, cactusArm);
    ellipse (220.44, cactusHeight, 98.039, 190);
    
    //flower
    fill(214, 171, flowerColor);
    noStroke();
    beginShape();
    curveVertex (106.31, 246.7);
    curveVertex (96.93, 241.91);
    curveVertex (94.92, 230.34);
    curveVertex (98.63, flowerSize);
    curveVertex (100.55, 230.61);
    curveVertex (106.1, 236.04);
    curveVertex (106.1, 233.22);
    curveVertex (107.38, flowerSize);
    curveVertex (113.13, flowerSize);
    curveVertex (117.82, 234.52);
    curveVertex (120.38, 229.52);
    curveVertex (126.78, flowerSize);
    curveVertex (127.84, 233.65);
    curveVertex (121.66, 243.87);
    curveVertex (115.37, 246.79);
    curveVertex (106.31, 246.7);
    endShape();
     
    //eyes black part
    fill(0);
    noStroke();
    ellipse (206.25, 209.41, eyeSize, eyeSize);
    ellipse (229.96, 209.41, eyeSize, eyeSize);
    
    //eyes white part
    fill(255);
    noStroke();
    ellipse (207.02, 208.28, 3.026, 3.026);
    ellipse (230.96, 208.28, 3.026, 3.026);
    
    //blush cheeks
    fill(193, 118, 148);
    noStroke();
    ellipse (198.2, 222.36, 7.791, blushHeight);
    ellipse (236.59, 222.36, 7.791, blushHeight);
     
    //mouth
    fill(0);
    noStroke(); 
    arc (219.36, 227.43, mouthWidth, mouthHeight, 0, PI );
     
 }

function mousePressed () {
    eyeSize = random(6.5, 12);
    mouthWidth = random(11, 44);
    mouthHeight = random(10, 25);
    flowerSize = random(220, 230);
    flowerColor = random(80, 255);
    blushHeight = random(4, 9);
    cactusHeight = random(190, 225); 
    cactusArm = random(65, 120);
    cactusColor = random(0, 150);
}

Charmaine Qiu – Project 02 – Variable Face


sketch

MousePressed was really fun to work with!

/* Charmaine Qiu
  Section E
  charmaiq@andrew.cmu.edu
  Project-02-Variable_Face */

var faceWidth = 200;
var faceHeight = 200;
var eyeSize = 20;
var eyebrow1 = 300;
var eyebrow2 = 300;
var mouthLeft = 230;
var mouthRight = 260;
var star = 5
var star2 = 7

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

function draw() {
    background(28, 42, 87);
    //stars
    fill(255);
    ellipse(100, 100, star, star);
    ellipse(400, 400, star, star);
    ellipse(300, 200, star2, star2);
    ellipse(60, 500, star2, star2);
    ellipse(120, 450, 6, 6);
    ellipse(200, 550, 3, 3);
    ellipse(350, 160, 3, 3);
    ellipse(80, 260, 3, 3);
    ellipse(420, 70, 5, 5);
    ellipse(300, 40, 4, 4);
    ellipse(420, 580, star, star);
    //body
    noStroke();
    fill(141, 230, 73);
    beginShape();
    vertex(230, 370);
    vertex(225, 450);
    vertex(235, 440);
    vertex(250, 500);
    vertex(255, 490);
    vertex(320, 480);
    vertex(330, 485);
    vertex(320, 430);
    vertex(335, 435);
    vertex(300, 370);
    endShape(CLOSE);
    //head
    ellipse(width / 2, height / 2, faceWidth,  faceHeight);
    triangle(220, 230, 230, 200, 240, 230);
    //eyes
    noStroke();
    fill(0);
    var eyeLX = width / 2 - faceWidth * 0.25;
    var eyeRX = width / 2 + faceWidth * 0.25;
    ellipse(eyeLX, height / 2, eyeSize, eyeSize);
    ellipse(eyeRX, height / 2, eyeSize, eyeSize);
    fill(222, 45, 13);
    ellipse(eyeLX, height / 2, eyeSize / 2, eyeSize / 2);
    ellipse(eyeRX, height / 2, eyeSize / 2, eyeSize / 2);
    //eyebrows
    triangle(150, 295, 160, 290, 190, eyebrow1);
    triangle(290, eyebrow1, 320, 290, 330, 295);
    //nose
    ellipse(width / 2, height/ 2, 7, 10);
    //mouth
    triangle(mouthLeft, 400, 240, 390, mouthRight, 400);

    // strokeWeight()
    // line(200, 320, width / 2 - faceWidth * 0.25, 320);
    // line(width / 2 - faceWidth * 0.25, 320, 260, 320);

}

function mousePressed() {
    // when the user clicks, these variables are reassigned
    // to random values within specified ranges. For example,
    // 'faceWidth' gets a random value between 75 and 150.
    faceWidth = random(150, 300);
    eyeSize = random(20, 50);
    eyebrow1 = random(290, 302);
    eyebrow2 = random(290, 302);
    mouthLeft = random(220,240);
    mouthRight = random(240,260);
    star = random(2, 15);
    star2 = random(2, 15);
}

Alec Albright – Project 02 – Variable Face

sketch

// ALec Albright
// Section B
// aalbrigh@andrew.cmu.edu
// Project 02

var hairHeight = 130;
var hairWidth = 365;
var hairRed = 230;
var foreheadH = 320;
var foreheadW = 160;
var foreheadBlue = 255;
var lowerRed = 240;
var noseBlue = 255;
var leftEyeY = 175;
var rightEyeY = 200;
var leftPupilX = 230;
var rightPupilX = 340;
var jawWeight = 30;

function setup(){
    height = 480
    width = 640
    createCanvas(width, height);
    angleMode(DEGREES);
}

function draw(){
    background("blue");
    // forehead
    fill(0, 255, foreheadBlue);
    noStroke();
    rect(140, 120, foreheadH, foreheadW);

    // lower half of face
    noStroke();
    fill(lowerRed, 0, 200);
    quad(125, 270, 475, 270, 370, 470, 250, 470);

    // mouth
    fill("black");
    arc(300, 370, 100, 40, -10, 170, PIE);

    // nose
    fill(153, 51, noseBlue);
    triangle(300, 230, 325, 320, 300, 330);

    // eyes
    fill("white");
    ellipse(240, leftEyeY, 45, 80);
    ellipse(350, rightEyeY, 60, 95);
    fill('black');
    ellipse(leftPupilX, leftEyeY + 15, 15, 30);
    ellipse(rightPupilX, rightEyeY + 20, 23, 40);

    // hair
    fill(hairRed, 130, 0);
    rect(120, 0, hairWidth, hairHeight, 160, 40, 60, 0);

    // jaw
    stroke('yellow');
    strokeWeight(jawWeight);
    line(150, 320, 250, 470);
    stroke("red");
    line(200, 445, 435, 445);
    stroke('limegreen');
    line(450, 295, 350, 505);
}

function mousePressed(){
    hairHeight = random(110, 150);
    hairWidth = random(335, 395);
    hairRed = random(0, 255);
    foreheadBlue = random(0, 255);
    foreheadH = random(300, 340);
    foreheadW = random(140, 180);
    lowerRed = random(0, 255);
    noseBlue = random(0, 255);
    leftEyeY = random(145, 205);
    rightEyeY = random(160, 240);
    leftPupilX = random(220, 260);
    rightPupilX = random(320, 360);
    jawWeight = random(10, 50);
    clear();
}

At the beginning of the process, I struggled to find what variables I would like to create, and what facial features I wanted to generate. I eventually wound up deciding that I wanted to change most structural aspects within constraints, a few color aspects, and absolutely let the pupils of the eyes cross if randomly selected to do so. Thus, I began toying with various features, dimensions, and colors until the result was a satisfying range of diversity in faces, based on my previous project.

Nawon Choi— Project-02 Variable Face

nawonc-variable-face

// Nawon Choi
// Section C
// nawonc@andrew.cmu.edu
// Project-02 Variable Faces

var sushiX = 233;
var sushiType = "egg";
var browHeight = 147;
var browAngle = 0;
var eyeballSize = 33;
var eyeSize = 1.5;


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

function draw() {
    // background
    noStroke();
    fill("#E3CBC8");
    rect(0, 0, 640, 250); 

    // hair
    noStroke();
    fill("#6A6159");
    ellipse(304, 250, 394, 500);

    noStroke();
    fill("#6A6159");
    ellipse(382, 249, 302, 465);

    // head
    noStroke();
    fill("#F2E3C2");
    ellipse(325, 236, 356, 423);

    // fringe
    noStroke();
    fill("#6A6159");
    quad(124, 182, 270, 125, 373, 30, 198, 61);

    noStroke();
    fill("#6A6159");
    triangle(223, 57, 294, 16, 373, 30);

    // eyebrows
    strokeWeight(10);
    stroke("#8F847B");
    noFill();
    beginShape();
    curveVertex(183, browHeight + browAngle);
    curveVertex(183, browHeight + browAngle);
    curveVertex(213, browHeight - browAngle);
    curveVertex(278, browHeight + browAngle);
    curveVertex(278, browHeight + browAngle);
    endShape();

    strokeWeight(10);
    stroke("#8F847B");
    noFill();
    beginShape();
    curveVertex(365, browHeight + browAngle);
    curveVertex(365, browHeight + browAngle);
    curveVertex(430, browHeight - browAngle);
    curveVertex(460, browHeight + browAngle / 2);
    curveVertex(460, browHeight + browAngle / 2);
    endShape();

    // eyes
    noStroke();
    fill("#ffffff");
    ellipse(224, 193, 57 * eyeSize, 46 * eyeSize);

    noStroke();
    fill("#ffffff");
    ellipse(417, 193, 57 * eyeSize, 46 * eyeSize);

    // eyeballs
    var leftEye = 224;
    var rightEye = 417;
    var eyeHeight = 200;
    var sushiCenter = sushiX + 88;

    if (sushiCenter < 201) {
        leftEye = 201,
        rightEye = 394;
    } else if (sushiCenter >= 201 & sushiCenter <= 225) {
        leftEye = sushiCenter,
        rightEye = 394;
    } else if (sushiCenter > 225 & sushiCenter < 394) {
        leftEye = 240,
        rightEye = 394;
    } else if (sushiCenter >= 394 & sushiCenter <= 418) {
        leftEye = 240,
        rightEye = sushiCenter;
    } else {
        leftEye = 240,
        rightEye = 418;
    }

    noStroke();
    fill("#6A6159");
    ellipse(leftEye, eyeHeight, eyeballSize, eyeballSize);

    noStroke();
    fill("#6A6159");
    ellipse(rightEye, eyeHeight, eyeballSize, eyeballSize);

    noStroke();
    fill("#FAFAFA");
    ellipse(leftEye-4, eyeHeight-4, 12, 12);

    noStroke();
    fill("#FAFAFA");
    ellipse(rightEye-4, eyeHeight-4, 12, 12);

    // table
    noStroke();
    fill("#AA827C");
    rect(0, 250, 640, 134);

    noStroke();
    fill("#9B736D");
    rect(0, 384, 640, 30);

    noStroke();
    fill("#E1ACA4");
    rect(0, 414, 640, 86);
    
    // rice
    noStroke();
    fill("#F3EEE9");
    rect(sushiX, 250, 175, 80, 29);

    if (sushiType == 'egg'){
        // egg
        noStroke();
        fill("#F2BD39");
        rect(sushiX-20, 224, 214, 53, 7);

        noStroke();
        fill("#F8D683");
        rect(sushiX-20, 224, 214, 20, 7);

        // seaweed
        noStroke();
        fill("#424944");
        rect(sushiX+72, 220, 30, 24);

        noStroke();
        fill("#27312B");
        rect(sushiX+72, 244, 30, 33);

        noStroke();
        fill("#151916");
        rect(sushiX+72, 277, 30, 53);
    } else if(sushiType == 'salmon'){
        // salmon
        noStroke();
        fill("#EC9326");
        rect(sushiX-20, 224, 214, 53, 7);

        var space = 32;
        var sushiY = sushiX + 19;

        strokeWeight(10);
        stroke('#F6CCAF');
        line(sushiX, 229, sushiY, 272);

        strokeWeight(10);
        stroke('#F6CCAF');
        line(sushiX + space, 229, sushiY + space, 272);

        strokeWeight(10);
        stroke('#F6CCAF');
        line(sushiX + space * 2, 229, sushiY + space * 2, 272);

        strokeWeight(10);
        stroke('#F6CCAF');
        line(sushiX + space * 3, 229, sushiY + space * 3, 272);

        strokeWeight(10);
        stroke('#F6CCAF');
        line(sushiX + space * 4, 229, sushiY + space * 4, 272);

        strokeWeight(10);
        stroke('#F6CCAF');
        line(sushiX + space * 5, 229, sushiY + space * 5, 272);
    } else if(sushiType == 'tuna') {
        // tuna
        noStroke();
        fill("#F2464A");
        rect(sushiX - 20, 224, 214, 53, 7);

        var space = 30;
        var sushiY = sushiX + 17;

        strokeWeight(5);
        stroke('#FFA2A9');
        line(sushiX + 35 - space, 229, sushiY - space, 272);

        strokeWeight(5);
        stroke('#FFA2A9');
        line(sushiX + 35, 229, sushiY, 272);

        strokeWeight(5);
        stroke('#FFA2A9');
        line(sushiX + space + 35, 229, sushiY + space, 272);

        strokeWeight(5);
        stroke('#FFA2A9');
        line(sushiX + space * 2 + 35, 229, sushiY + space * 2, 272);

        strokeWeight(5);
        stroke('#FFA2A9');
        line(sushiX + space * 3 + 35, 229, sushiY + space * 3, 272);

        strokeWeight(5);
        stroke('#FFA2A9');
        line(sushiX + space * 4 + 35, 229, sushiY + space * 4, 272);

        strokeWeight(5);
        stroke('#FFA2A9');
        line(sushiX + space * 5 + 35, 229, sushiY + space * 5, 272);
    }

}

function mousePressed() {
    // variables are reassigned when user clicks
    let sushis = ['egg', 'salmon', 'tuna']
    floats = [1.0, 1.1, 1.2, 1.3, 1.4, 1.5];
    colors = ['#6A6159', '#c795b5', '#1d3f75', '#c9b75b', '#cc7a4e', '#6d1873'];
    sushiX = random(38, 430);
    sushiType = random(sushis);
    eyeballSize = random (23, 43);
    eyeSize = random (floats);
    browHeight = random(137, 160);
    browAngle = random(0, 10);


}

I made three different kinds of sushi and made them correlate to different string variables, “egg”, “salmon”, and “tuna”. I also tried to make the position of the eyes correspond to the location of the sushi so that the eyes would follow the sushi. It was fun playing around with different variables to see what types of expressions could be made just by switching around different values.

I showed this to a friend and they mentioned that it kind of looks like sushi going along a conveyor belt!

Sean Leo-Project 02-Variable Faces

sketch

//Sean B. Leo
//sleo@andrew.cmu.edu
//Section C
//Project_02

var eyeSize = 20;
var pupil = 10;
var faceWidth = 100;
var faceHeight = 150;
var red = ("red");
var green = ("green");
var blue = ("blue");
var r1 = 255;
var g1 = 255;
var b1 = 255;
var r2 = 255;
var g2 = 255;
var b2 = 255;
var A = 20;
var B = 40;
var C = 1;

function setup() {
    createCanvas(600, 500);
}
 
function draw() {
  background(red, green, blue);
  let c = color(255, 255, 255);
  
   //body
  fill(r2, g2, b2);
  ellipse(width/2, height/2 + faceHeight, faceWidth + (faceWidth/2), faceHeight + (faceHeight/2));
  //ellipse((width / 2) + faceWidth, (height / 2) + faceHieght, faceWidth * 2, faceHeight * 2);
  
  //head  
  fill(r1, g1, b1),
  ellipse(width / 2, height / 2, faceWidth,  faceHeight);


  //eyes  
  fill(255);
  var eyeHeightLX = (height/2);
  var eyeHeightRX = (height/2);
  var eyeLX = width / 2 - faceWidth * 0.25;
  var eyeRX = width / 2 + faceWidth * 0.25;
    ellipse(eyeLX, height / 2, eyeSize, eyeSize);
    ellipse(eyeRX, height / 2, eyeSize, eyeSize);
  
  //pupils
  fill(0);
    ellipse(eyeLX, eyeHeightLX, pupil, pupil);
    ellipse(eyeRX, eyeHeightRX, pupil, pupil);
  
  //eyebrows
  {strokeWeight(3);
   var eyeBrowLH1 = eyeHeightLX-pupil*2;
   var eyeBrowLH2 = eyeHeightLX-pupil*C;
   var eyeBrowRH1 = eyeHeightRX-pupil*C;
   var eyeBrowRH2 = eyeHeightRX-pupil*2;
  line(eyeLX-pupil, eyeBrowLH1, eyeLX+pupil, eyeBrowLH2);
  line(eyeRX-pupil, eyeBrowRH1, eyeRX+pupil, eyeBrowRH2);
  }
  //mouth
  fill(0);
  var mouthHeight=height/2 + faceHeight *.30;
  ellipse(width/2, mouthHeight, B, 20);
  
  //nose
  fill(r1, g1, b1);
  arc(width/2, height/2 + faceHeight*.09, A, A, C, PI + QUARTER_PI, OPEN);
  
  
}
 
function mousePressed() {
  red = random(0,255);
  green = random(0, 255);
  blue = random(0, 255);
  r1 = random(20, 255);
  g1 = random(20, 255);
  b1 = random(20, 255);
  r2 = random(0, 255);
  g2 = random(0, 255);
  b2 = random(0, 255);
  A = random(1,30);
  B = random(1,40);
  C = random(1,3);
  faceWidth = random(75, 250);
  faceHeight = random(75, 250);
  eyeSize = random(10, 30);
  pupil = random(7, 12);
}

A big part of figuring out this project was trying to wrap my head around what was spatially dependent on what. It was easier to think of things modularly; if the eyebrow is linked to the eye and if the eye is linked to the head, if the head changes everything else will follow.

Hyejo Seo-Project-02-Variable-Face


sketch

Are you forgetting something? 

Oh, yes! 

/*
Hyejo Seo
Section A
hyejos@andrew.cmu.edu
Project-02-Variable-Face
*/


var faceW = 300;
var faceH = 250;
var eyeH = 150;
var eyeW = 110;
var ex1 = 190;
var ex2 = 290;
var r = 240; 
var g = 72;
var b = 75; 


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

function draw() {
    background(47, 50, 47);
    //face
    fill(r, g, b);
    noStroke();
    ellipse(240, 530, faceW, faceH);
    // eyes
    fill(255);
    noStroke();
    ellipse(300, 520, eyeW, eyeH);
    ellipse(180, 520, eyeW, eyeH);
    // pupils
    fill(0);
    ellipse (295, 470, eyeW/2 - 20, eyeH/2 - 40);
    ellipse (185, 470, eyeW/2 - 20, eyeH/2 - 40);
    //exclamation mark
    noFill();
    stroke(221, 249, 193);
    strokeWeight(10);
    quad(ex1, 100, ex2, 100, 245, 250, 235, 250);
    circle(240, 320, 50);
}

function mousePressed() {
    faceW = random(150, 400);
    faceH = random(150, 300);
    eyeW = random(90, 130);
    g = random(0, 80);
    b = random(0, 100);
    ex1 = random(100, 190);
    ex2 = random(290,380);
    
}

Min Ji Kim Kim – Project 02 – Variable-Face


sketch

I had so much fun doing the project this week. The hardest part was trying to figure out how to use the if statement to get the single or double eye as well as understanding how to manipulate variables for the mousePressed function.

/*
Min Ji Kim Kim
Section-A
mkimkim@andrew.cmu.edu
Project-02
*/

//variables
var mouthHeight = 330;
var mouthWidth = 80;
var irisSize = 25;
var pupilSize = 12;
var headColor = 231;
var overallsColor = 130;
var eyeNumber = 2;


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

function draw() {
    noStroke();
    //head
    fill(254, headColor, 81);
    rect(210, 150, 220, 300, 100, 100, 0, 0);

    //goggle band
    fill(47, 47, 41);
    rect(210, 235, 220, 20);

    //Number of eyes
    if (eyeNumber >= 2){
        //two eyes
        //goggles
        fill(201, 208, 202);
        circle(280, 245, 90);
        circle(360, 245, 90);
        //eyes
        fill(255);
        circle(280, 245, 70);
        circle(360, 245, 70);
        //iris
        fill(102, 45, 19);
        circle(280, 245, irisSize);
        circle(360, 245, irisSize);
        //pupils
        fill(0);
        circle(280, 245, pupilSize);
        circle(360, 245, pupilSize);

    } else {
        //one eye
        //goggle
        fill(201, 208, 202);
        circle(320, 245, 90);
        //eye
        fill(255);
        circle(320, 245, 70);
        //iris
        fill(102, 45, 19);
        circle(320, 245, irisSize);
        //pupil
        fill(0);
        circle(320, 245, pupilSize);

    }

    //overalls
    strokeWeight(1.5);
    stroke(172, 121, 77);
    fill(53, 96, overallsColor);
    rect(210, 400, 220, 50);

    //mouth
    fill(255);
    strokeWeight(3);
    stroke(200, 117, 0);
    arc(320, mouthHeight, mouthWidth, 80, 0, PI, CHORD);

}

function mousePressed(){
    // when the user clicks, these variables are reassigned
    // to random values within the specifed ranges.
    mouthHeight = random(300, 340);
    mouthWidth = random(30, 100);
    irisSize = random(20, 30);
    pupilSize = random(8, 16);
    headColor = random(180, 240);
    overallsColor = random(100, 250);
    eyeNumber = random(1,3);

}

Ghalya Alsanea – Project 02 – Variable Face

Gnomes of the world unite!

sketch

//Ghalya Alsanea
//Section B
//galsanea@andrew.cmu.edu
//Project-02

var eyeSize = 20;
var faceWidth = 100;
var faceHeight = 150;
var faceR = 141;
var faceG = 85;
var faceB = 36;
var eyeG = 0;
var eyeB = 0;
var shirtColor = 100;

function setup() {
    createCanvas(480, 640);
    angleMode(DEGREES);
}

function draw() {
    background(150);
    strokeWeight (1);
    stroke(0);

    // face
    fill (faceR, faceG, faceB);
    ellipse(width / 2, height / 2, faceWidth,  faceHeight);
    
    //eyes
    fill (255);
    var eyeLX = width / 2 - faceWidth * 0.25;
    var eyeRX = width / 2 + faceWidth * 0.25;
    ellipse(eyeLX, height / 2, eyeSize, eyeSize);
    ellipse(eyeRX, height / 2, eyeSize, eyeSize);
    
    //pupils
    fill (0, eyeG, eyeB);
    ellipse(eyeLX, height / 2, eyeSize / 2, eyeSize / 2);
    ellipse(eyeRX, height / 2, eyeSize / 2, eyeSize / 2);

    // //nose
    fill (185, 150, 130);
    var noseWidth = faceWidth * 0.15;
    var noseHeight = height / 2 + faceHeight * 0.15;
    triangle(width / 2, height / 2, width / 2 + noseWidth, noseHeight, width / 2 - noseWidth, noseHeight);

    //body
    fill(0, shirtColor, faceB);
    var bodyHeight = faceHeight * 4;
    var bodyX = width / 2;
    var bodyY = height/2 + bodyHeight /2 + faceHeight / 2;
    ellipse(bodyX, bodyY, faceWidth, bodyHeight);

    //hat
    fill(shirtColor, 0, faceB);
    var hatWidth = faceWidth / 2;
    var hatHeight = height / 2 - faceHeight / 3;
    triangle(width / 2, height / 2 - faceHeight, width / 2 - hatWidth, hatHeight, width / 2 + hatWidth, hatHeight);

    //mouth
    noFill();
    strokeWeight (3);
    var mouthHeight = faceHeight * 0.25;
    arc(width / 2, height / 2 + mouthHeight, faceWidth / 2, mouthHeight, 0, 180, OPEN);


    // //eyebrows
    var browLX = width / 2 - faceWidth * 0.25;
    var browRX = width / 2 + faceWidth * 0.25;
    arc(browLX, height / 2 - eyeSize, eyeSize, eyeSize, 200, 340, OPEN);
    arc(browRX, height / 2 - eyeSize, eyeSize, eyeSize, 200, 340, OPEN);

    //pupils
    fill (0);
    stroke (0, eyeG, eyeB);
    ellipse(eyeLX, height / 2, eyeSize / 2, eyeSize / 2);
    ellipse(eyeRX, height / 2, eyeSize / 2, eyeSize / 2);
}

function mousePressed() {
    // when the user clicks, these variables are reassigned
    //to random values within specified ranges.
    faceWidth = random(75, 300);
    faceHeight = random(115, 350);
    eyeSize = random(30, 50);
    eyeG = random(0, 255);
    eyeB = random(0, 255);
    shirtColor = random(100, 200);
    
    //random skin color generator
    var x = round(random (0.5, 5.5));

    // skin shade 1 -- Russet
    if (x == 1) {
        faceR = 141;
        faceG = 85;
        faceB = 36;
    } 

    // skin shade 2 -- Peru
    if (x == 2) {
        faceR = 198;
        faceG = 134;
        faceB = 66;
    } 

    // skin shade 3 -- Fawn
    if (x == 3) {
        faceR = 224;
        faceG = 172;
        faceB = 105;
    } 

    // skin shade 4 -- Mellow Apricot
    if (x == 4) {
        faceR = 241;
        faceG = 194;
        faceB = 125;
    } 

    // skin shade 5 -- Navajo White
    if (x == 5) {
        faceR = 255;
        faceG = 219;
        faceB = 172;
    } 


}

I wanted to create different gnomes and have their hat and shirt color be relative to each other, so I referenced the RGB value of the skin value. That way their outfits somehow match.

Also, I wanted to create real skin tones and used the generic 5 shade skin tones found here, and randomized it so that every time you click, the skin changes.

Finally, the eyebrows and smiles and the rest of the facial features are referencing each other so that they change proportionally with the face size and eye size.