Kyle Lee Variable Face

The biggest challenge for me was properly sorting the local variables, global variables, and mouse pressed function. I felt good about the lines of code that I wrote, but it took me a long time of moving the lines to different locations in the code to finally get the result I wanted.

kdlee-project-02

var faceWidth = 100;
var faceHeight = 150;
var mouthWidth = 50;
var mouthHeight = 20;
var eyeSize = 20;
var eyeLidWidth = 10;
var eyeLidHeight = 2;
var irisColor = '#A46861';
var colors = ['#A46861', '#8CAEDC', '#A9BD8C'];

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

function draw() {
    background('#5D8FA4');
    noStroke();

//HEAD
    fill('#F2C4A2');//SKIN TONE
    ellipse(width / 2, height / 2, faceWidth,  faceHeight);//HEAD
//MOUTH
    fill(0);//BLACK
    ellipse(width / 2, height / 2 + faceHeight / 4, mouthWidth, mouthHeight);//MOUTH

//EYE WHITES
    var eyeLX = width / 2 - faceWidth * 0.25;
    var eyeRX = width / 2 + faceWidth * 0.25;
    fill(250);//WHITE
    ellipse(eyeLX, height / 2, eyeSize, eyeSize);//LEFT EYE
    ellipse(eyeRX, height / 2, eyeSize, eyeSize);//RIGHT EYE
//EYE IRIS
    var eyeIris = 9;
    fill(irisColor);//IRIS COLOR
    ellipse(eyeLX, height / 2, eyeIris, eyeIris);//LEFT IRIS
    ellipse(eyeRX, height / 2, eyeIris, eyeIris);//RIGHT IRIS
//EYE PUPIL
    var eyeP = 5;
    fill(0);//BLACK
    ellipse(eyeLX, height / 2, eyeP, eyeP);//LEFT PUPIL
    ellipse(eyeRX, height / 2, eyeP, eyeP);//RIGHT PUPIL
//EYELIDS
    var eyeLidY = height / 2 - eyeSize
    noFill();
    stroke(1);
    strokeWeight(2);
    arc(eyeLX, eyeLidY, eyeLidWidth, eyeLidHeight, PI, 0);//LEFT EYELID
    arc(eyeRX, eyeLidY, eyeLidWidth, eyeLidHeight, PI, 0);//RIGHT EYELID
}

function mousePressed() {
    faceWidth = random(75, 150);
    faceHeight = random(100, 200);
    mouthWidth = random(50, 30);
    mouthHeight = random(30, 5);
    eyeSize = random(10, 30);
    eyeP = random (5, eyeSize - 10);// Pupil
    eyeIris = (eyeSize - eyeP) / 2; //Iris size
    eyeLidWidth = random(12, 7);
    eyeLidHeight = random(7, 0);
    irisColor = random(colors);
}

Project-02-Charlie Mo

sketch

var eyeHeight=15;
var eyeWidth=55;
var noseSize=6;
var browHeight1=2;
var browHeight2=2;
var faceWidth=200;
var faceHeight=250;
var ballSize=10;
var mouthLength=40;




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

function draw() {

	//face
	fill(255);
	ellipse(width/2,height/2,faceWidth,faceHeight);

	//eye
	var eyeLX= width/2-faceWidth*0.3;
	var eyeLY= height/2+faceHeight*0.1;
	var eyeRX= width/2+faceWidth*0.2;
	var eyeRY= height/2+faceHeight*0.1;
	fill(255);
	ellipse(eyeLX,eyeLY,eyeWidth,eyeHeight);
	ellipse(eyeRX,eyeRY,eyeWidth,eyeHeight);

	//eyeballs
	fill(0);
	ellipse(eyeLX,eyeLY,ballSize,ballSize);
	ellipse(eyeRX,eyeRY,ballSize,ballSize);

	//nose
	var noseLX= width/2-faceWidth*0.08;
	var noseLY= height/2+faceHeight*0.2;
	var noseRX= width/2+faceWidth*0.000000000001;
	var noseRY= height/2+faceHeight*0.2;
	fill(0);
	ellipse(noseLX,noseLY,noseSize,noseSize);
	ellipse(noseRX,noseRY,noseSize,noseSize);

	//brow
	var browLX= width/2-faceWidth*0.45;
	var browLY= height/2+faceHeight*0.01;
	var browRX= width/2+faceWidth*0.1;
	var browRY= height/2+faceHeight*0.01;
	fill(0);
	rect(browLX,browLY,50,browHeight1);
	rect(browRX,browRY,50,browHeight2);

	//mouth
	var mouthX= width/2-faceWidth*0.08;
	var mouthY= height/2+faceHeight*0.27;
	rect(mouthX,mouthY,15,mouthLength);

}

function mousePressed() {
    //change nostril size
    noseSize = random(6,12);

    //change pupil size
    ballSize = random(2,12);

    //change mouth size
    mouthLength = random(10, 55);
}

		


Andrew-Project02-VariableFaces

sketch

// Simple beginning template for variable face.
var eyeSize = 20;
var eyeInside = 10;
var faceWidth = 100;
var faceHeight = 150;
var earWidth = 5;
var earHeight = 20;
var noseBridge = 15;
var hairType = 3;
var colorR = 180;
var colorG = 180;
var colorB = 180;
var colorR2 = 200;
var colorG2 = 200;
var colorB2 = 200;
var mouthWidth = 20;
var mouthHeight = 5;
var mouthPosition = 4;
var eyeBrow = 1;

function setup() {
    createCanvas(300, 300);
}
function draw() {
    background(colorR, colorG, colorB);
      
    noStroke();
    fill(255);
    switch(hairType) {
        case 1:
            fill(colorR2, colorG2, colorB2);
            ellipse(width/2, height/2+faceHeight/6, faceWidth+30, faceHeight+80);
            break;
        case 2:
            fill(color(colorR2, colorG2, colorB2));
            rectMode(CENTER);
            rect(150, 150-faceHeight/2.5, faceWidth-20, faceHeight/6,80);
            rect(150, 150-faceHeight/2.5, faceWidth-50, faceHeight/2,90);
            break;
        default:
            strokeWeight(10);
            stroke(color(colorR2, colorG2, colorB2));
            arc(150, 150, faceWidth, faceHeight, PI, 0);
    }
    fill(255);
    strokeWeight(1);
    noStroke();
    //face
    ellipse(width / 2, height / 2, faceWidth,  faceHeight);

    var eyeLX = width / 2 - faceWidth * 0.25;
    var eyeRX = width / 2 + faceWidth * 0.25;
    var earLX = width / 2 - faceWidth / 2;
    var earRX = width / 2 + faceWidth / 2;
    var mouthY = height / 2 + faceWidth / mouthPosition;
    noStroke();
    //ear
    ellipse(earLX, height / 2, earWidth, earHeight);
    ellipse(earRX, height / 2, earWidth, earHeight);
    fill(colorR, colorG, colorB);
    //eye
    ellipse(eyeLX, height / 2, eyeSize, eyeSize);
    ellipse(eyeRX, height / 2, eyeSize, eyeSize);
    fill(255);
    ellipse(eyeLX, height / 2, eyeInside, eyeInside);
    ellipse(eyeRX, height / 2, eyeInside, eyeInside);
    fill(colorR, colorG, colorB);
    //nose
    stroke(color(colorR, colorG, colorB));
    line(150,160,150,150+noseBridge);
    //mouth
    ellipse(width / 2, mouthY, mouthWidth, mouthHeight);
    //neck
    rectMode(CENTER);
    fill(255);
    noStroke();
    rect(150, 150+faceHeight/2,25,30);
    //eyebrows
    switch(eyeBrow) {
        case 1:
            noFill();
            stroke(color(colorR, colorG, colorB));
            arc(eyeLX, eyeRX-40, 30, 30, PI, 0);
            arc(eyeRX, eyeRX-40, 30, 30, PI, 0);
            break;
        case 2:
            noFill();
            stroke(color(colorR, colorG, colorB));
            strokeWeight(4);
            line(eyeLX-10, eyeRX-50, eyeLX+10,eyeRX-50);
            line(eyeRX-10, eyeRX-50, eyeRX+10,eyeRX-50);
            break;
        default:
            noFill();
            stroke(color(colorR, colorG, colorB));
            arc(eyeLX-10, eyeRX-faceHeight/2, 40, 20, 0, HALF_PI);
            arc(eyeRX+10, eyeRX-faceHeight/2, 40, 20, HALF_PI, PI);
    }
    if (hairType == 1) {
        noStroke();
        fill(colorR2, colorG2, colorB2);
        arc(150, 150-faceHeight/4, faceWidth/1.1, faceHeight/1.9, PI, 0);
    }
}
 
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.
    colorRandomizer();
    colorRandomizer2();
    faceWidth = random(75, 150);
    faceHeight = random(100, 200);
    eyeSize = random(10, 30);
    earWidth = random(5, 15);
    earHeight = random(15, 30);
    hairType = floor(random(1, 4));
    mouthPosition = random(2, 5);
    mouthWidth = random(10, 30);
    mouthHeight = random(1, 5);
    noseBridge = random(5,20);
    eyeInside = random(5,10);
    eyeBrow = floor(random(1,4));
}
function colorRandomizer() {
    colorR = random(0, 250);
    colorG = random(0, 250);
    colorB = random(0, 250);
}
function colorRandomizer2() {
    colorR2 = random(0, 250);
    colorG2 = random(0, 250);
    colorB2 = random(0, 250);
}

I tried changing the eyebrows and hairstyles in this project as I think eyebrows are the easiest way to express different emotions, and hairstyles can make the individual look drastically different. Other than that I changed the variable and position of the mouth, nose, eyes, and ears to represent differences.

Project-02-Variable-Face

michal-portrait-2

var sunColorR = 145;
var sunColorG = 13;
var sunColorB =  63;
var noseTip = 275;
var themeStatus = 2;
var hairAngle = 0;
var neckLength = 130;
var faceLength = 180;

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

function draw() {
	background(255, 87, 51);

	//spotlight = theme no. 1 for clicks
	if (themeStatus == 1) {

		//bottom light
		noStroke();
		fill(253, 248, 209);
		triangle(640, 480, 0, 480, 0, 400);
		triangle(640, 480, 0, 370, 0, 275);
		triangle(640, 480, 0, 200, 0, 100);

		//top light
		fill(253, 250, 228);
		triangle(640, 0, 0, 480, 0, 400);
		triangle(640, 0, 0, 370, 0, 275);
		triangle(640, 0, 0, 240, 0, 130);

	}

	//face
	fill(255, 195, 1);
	noStroke();
	rect(120, 130, 80, neckLength);
	stroke(225, 195, 15);
	strokeWeight(1)
	rect(160, 128, 100, faceLength, 50);

	//nose
	triangle(257, 216, 257, 246, noseTip, 246);

	//sunglasses
	stroke(90, 24, 70);
	strokeWeight(5);
	line(170, 200, 260, 200);
	fill(sunColorR, sunColorG, sunColorB);
	ellipse(230, 210, 37);

	//lips
	stroke(145, 13, 63);
	strokeWeight(1);
	fill(199, 0, 57);
	triangle(245, 270, 260, 270, 260, 260);
	triangle(245, 270, 260, 270, 260, 280);

	//hair
	noStroke();
	fill(145, 13, 63);
	triangle(100, 130, 270, 85, 270, 160);
	fill(125, 13, 63);
	triangle(100, 130, 150, 137, 100, 300);
	fill(105, 23, 63);
	rect(80, 130, 60, 230);
	fill(145, 23, 63);
	triangle(40 - hairAngle, 350 - hairAngle, 140 - hairAngle, 350, 120, 130);
	fill(135, 13, 63);
	triangle(150, 130, 180, 140, 130, 210);

	//music = theme no. 2 for clicks
	if (themeStatus == 2) {

		//headphones
		fill(90, 24, 70);
		ellipse(170, 215, 55);
		fill(199, 0, 57);
		ellipse(175, 210, 55);

		//headphone curve
		quad(195, 105, 235, 95, 190, 200, 160, 200);

		//note 1
		fill(0);
		ellipse(350, 210, 16);
		ellipse(400, 200, 16);
		stroke(0);
		strokeWeight(6);
		line(350, 160, 400, 150);
		line(353, 160, 353, 210);
		line(403, 150, 403, 200);

		//note 2
		fill(0);
		noStroke();
		ellipse(550, 110, 16);
		ellipse(600, 100, 16);
		stroke(0);
		strokeWeight(6);
		line(550, 50, 600, 40);
		line(553, 50, 553, 110);
		line(603, 100, 603, 40);

		//note 3
		noStroke();
		ellipse(470, 160, 16);
		stroke(0);
		strokeWeight(6);
		line(475, 160, 460, 120);
		line(460, 120, 470, 115);

	} 
	//party = theme no. 3 for clicks
	if  (themeStatus == 3) {

		//party hat
		fill(1, 192, 255);
		triangle(80, 140, 140, 20, 270, 85);
		fill(15, 118, 184);
		ellipse(140, 20, 35);

		//party whistle 
		stroke(15, 118, 184);
		strokeWeight(12);
		line(260, 270, 340, 250);
		noStroke();
		fill(15, 118, 184);
		ellipse(340, 240, 20);
		fill(1, 192, 255);
		ellipse(345, 242, 20);

	}

}

function mousePressed() {
    // when the user clicks, these variables are reassigned
    sunColorR = random(0, 255);
    sunColorG = random(0, 255);
    subColorB = random(0, 255);
    noseTip = random(275, 340);
    hairAngle = random(0, 90);
    neckLength = random(170, 400);
    faceLength = random(180, 220);
   	
   	//changing theme status
   	if (themeStatus == 1) {
   		themeStatus = 2;

   	} else if (themeStatus == 2) {
   		themeStatus = 3;

   	} else if (themeStatus == 3){
   		themeStatus = 1;

   	}
    
}

When working on this project, I thought it would be more interesting to take the self-portrait I already made and try and think of interesting ways in which it can be modified. I started by playing with some features by randomizing them, but it was also interesting to move around angles, as well as completely changing central elements of the portrait to create a new meaning.

Project-02-Variable-Face- sehenry

While I was making this project, I became very interested in the way that the random function works. A simple but complex concept that I will try to use in a majority of my projects. I didn’t sketch any drafts for this one like the Family Composition. I also tried to randomize a triangle nose within my sketch but it became very difficult and I was forced to switch to an ellipse nose.

sketch

//Seth Henry

//Section B (Tuesdays 10:30)

//sehenry@andrew.cmu.edu

//Assignment-Variable Faces

var eyeSize = 50
var pupilSize = 20
var headHeight = 200
var headWidth = 170
var noseHeight = 30
var noseWidth = 20
var mouthHeight = 30
var mouthWidth = 100
var browHeight = 10
var browWidth = 40
var earHeight = 50
var earWidth = 40




function setup() {
    createCanvas(640, 480);
    
    text("p5.js vers 0.5.2 test.", 10, 15);
}

function draw() {
	background(102, 102, 202);
	noStroke(0);
	fill(255);

	//hair: Becomes randomized when headwidth is randomized
	rectMode(CENTER);
	fill(0);
	rect(width / 2, 150, headWidth, 150);

	//nose: Center of Face (Triangle Nose Test. THIS WAS ONLY A TEST)
	var leftpointW = width / 2 - 10
	var leftpointH = height / 2 + 40
	var rightpointW = width / 2 + 10
	var rightpointH = height / 2 + 40
	fill(0);
	triangle(width / 2, height / 2, leftpointW, leftpointH, rightpointW, rightpointH);


	//ear
	var leftEarW = width / 2 - headWidth / 2
	var rightEarW = width / 2 + headWidth / 2
	fill(163, 121, 7);
	ellipse(leftEarW, height / 2, earWidth, earHeight);
	ellipse(rightEarW, height / 2, earWidth, earHeight);


	//head: Middle of Canvas
	fill(163, 121, 7);
	ellipse(width / 2, height / 2, headWidth, headHeight);

	//eyes 
	fill(255);
	var leftEye = width / 2 - headWidth/3.25
	var rightEye = width / 2 + headWidth/3.25
	ellipse(leftEye, height / 2, eyeSize, eyeSize);
	ellipse(rightEye, height / 2, eyeSize, eyeSize);

	//pupils: center of eyes
	fill(random(10, 200), 20, 120);
	ellipse(leftEye, height / 2, pupilSize, pupilSize);
	ellipse(rightEye, height / 2, pupilSize, pupilSize);

	//nose: Center 
	fill(0);
	ellipse(width / 2, height / 2 + 20, noseWidth, noseHeight);
	
	//mouth
	fill(235, 70, 177);
	ellipse(width / 2, height / 2 + 70, mouthWidth, mouthHeight);

	//brow: centered over eyes
	rectMode(CENTER);
	fill(0);
	rect(leftEye, height / 2 - 50, browWidth, browHeight);
	rect(rightEye, height / 2 - 50, browWidth, browHeight);


}

	function mousePressed(){ //11 Random Aspects
		headWidth = random(150, 200);
		headHeight = random(180, 220);
		mouthHeight = random(20, 50);
		mouthWidth = random(40, 150);
		eyeSize = random(30, 70);
		pupilSize = random(10, 40);
		browWidth = random(20, 70);
		earHeight = random(30, 80);
		earWidth = random(20, 60);
		rightpointW = random(height / 2 + 30, height / 2 + 50); //A PART OF THE TRIANGLE NOSE TEST
		noseheight = random(10, 200);
		noseWidth = random(10, 40);



	}


	




Project-02-Variable-Face

sketch

//Janet Lee
//Section C
//janetl2@andrew.cmu.edu
//Assignment-02
var eyeSize = 20;
var faceWidth = 100;
var faceHeight = 150;
var noseX = 10;
var noseY =20;
var mouthX = 15;
var mouthY = 5;
var eyebrowX= 15;
var eyebrowY =5;

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

function draw() {
    background('#FCA49F');
    noStroke();
    fill ('#FCC3B2');
    //face
    ellipse(width / 2, height / 2, faceWidth,  faceHeight);
    //eyes
    var eyeLX = width / 2 - faceWidth * 0.25;
    var eyeRX = width / 2 + faceWidth * 0.25;
    fill (0);
    ellipse(eyeLX, height / 2, eyeSize, eyeSize);
    ellipse(eyeRX, height / 2, eyeSize, eyeSize);
    //nose
    fill ('#A87688');
    ellipse (width / 2,height / 2,noseX,noseY);
    //mouth
    fill (0);
    ellipse (width /2 ,280,mouthX,mouthY);
    //eyebrow
    fill(0);
    ellipse (eyeLX,220 ,eyebrowX,eyebrowY);
    ellipse (eyeRX, 220, eyebrowX,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.
    faceWidth = random(75, 150);
    faceHeight = random(100, 200);
    eyeSize = random(10, 30);
    noseX = random (5,15);
    noseY = random (10,30);
    mouthX = random(5,20);
    mouthY = random (3,10);
}

Project-02-Variable-Face

For this project, my idea was to start out with a relatively normal-looking, black-and-white image of a face and when the user clicked on it, the face would immediately erupt with color. Thus, as one can see, all features of the face change color with each click. Originally, I was also going to make the background change color as well, but unfortunately I was unable to find a way to do so. In order to play with the emotion of the face, I focused on making subtle changes to the eyebrows, eyes, and mouth. I chose these features because I believe that they can tell the most about a person’s emotions. The combination of these changing features — color, shape, and position — allow facial expressions to range from looking surprised, sinister, happy, and more.

Project 2: Variable Faces

/*Emma Shi
Section B
eyshi@andrew.cmu.edu
Variable Faces Project 2
*/

var eyepupil = 20
var eye = 40
var facewidth = 250
var faceheight = 300
var eyex = 356
var eyey = 238
var cheekw = 50
var cheekh = 40
var cheekx = 242
var cheeky = 296
var earlx = 174
var eary = 280
var earrx = 425
var earring = 14
var arcA = 229
var arcAA = arcA + 104
var arcB = 200
var arcC = 90
var arcStart = 1
var arcStop = 0
var arcLipA = 300
var arcLipB = 340
var arcChord = 0
var mid = 300
var z = 0
var x3arc = 84.88
var y3arc = 201
var oh = 100

var rBlack = 0
var gBlack = 0
var bBlack = 0
var White = 285
var rWhite = 285
var gWhite = 285
var bWhite = 285
var rHair = 15
var gHair = 15
var bHair = 15
var rEyebrow = 16
var gEyebrow = 16
var bEyebrow = 16
var rCheek = 158
var gCheek = 158
var bCheek = 158
var rLip = 78
var gLip = 78
var bLip = 78
var rNose = 144
var gNose = 144
var bNose = 144
var rEar = 140
var gEar = 140
var bEar = 140
var rFace = 181
var gFace = 181
var bFace = 181

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

function draw() {

	fill(rFace, gFace, bFace);
	noStroke();
    ellipse(faceheight, facewidth + 10, facewidth, faceheight);//face
    rect(facewidth + 20, faceheight + 50, faceheight / 5, facewidth - 110);//neck

fill(255);
    ellipse(eyex, eyey, eye, eye);//right eye 
    ellipse(eyex - 100, eyey, eye, eye);//left eye

    noFill();
    stroke(rEyebrow, gEyebrow, bEyebrow);
    strokeWeight(3);
    arc(arcA, arcB, arcC, arcStart, arcStop, HALF_PI);//left eyebrow
    arc(arcAA, arcB, arcC, arcStart, arcStop, HALF_PI);//right eyebrow

    noFill();
    stroke(rHair, gHair, bHair);
    strokeWeight(6);
    arc(mid, mid - 20, mid - 40, mid + 58, x3arc, y3arc, HALF_PI);//hair outline
    arc(mid, mid, mid - 40, mid + 58, x3arc, y3arc, HALF_PI);//hair outline
    arc(mid, mid - 10, mid - 40, mid + 58, x3arc, y3arc, HALF_PI);//hair outline
    arc(mid, mid - 5, mid - 40, mid + 58, x3arc, y3arc, HALF_PI);//hair outline    
    arc(mid, mid - 15, mid - 40, mid + 58, x3arc, y3arc, HALF_PI);//hair outline

    fill(rHair, gHair, bHair);
    ellipse(mid, 70, eye*2, eye*2);//hair bun

    noFill();
    strokeWeight(3);
    arc(eyex, eyey, 44, 45, mid + 80, 50, HALF_PI);//right eye liner
    arc(eyex - 100, eyey, 44, 45, mid + 80, 50, HALF_PI);//left eye liner

    noStroke();
    fill(rBlack, gBlack, bBlack);
    ellipse(eyex + 10, eyey + 1, eyepupil, eyepupil);//left eye pupil
    ellipse(eyex - 90, eyey + 1, eyepupil, eyepupil);//right eye pupil

    fill(White);
    ellipse(eyex - 90, eyey + 1, eye/9, eye/9);//right eye pupil light
    ellipse(eyex + 10, eyey + 1, eye/9, eye/9);//left eye pupil light

noStroke();
    fill(rNose, gNose, bNose);
    ellipse(mid, mid, oh - 60, oh / 5);//nose

    fill(rCheek, gCheek, bCheek);
    ellipse(cheekx, cheeky, cheekw, cheekh);//left cheek
    ellipse(cheekx + 120, cheeky, cheekw, cheekh);//right cheek

    fill(rFace, gFace, bFace);
    ellipse(earlx, eary, oh - 76, 60);//left ear 
    ellipse(earrx, eary, oh - 76, 60);//right ear

    fill(rEar, gEar, bEar);
    ellipse(earlx, eary, earring, oh / 5);//left inner ear
    ellipse(earrx, eary, earring, oh / 5);//right inner ear

    fill(rWhite, gWhite, bWhite);
    ellipse(earlx, eary + 20, earring, earring);//left earring
    ellipse(earrx, eary + 20, earring, earring);//right earring

    fill(White)
    stroke(rLip, gLip, bLip);
    strokeWeight(4); //lip outline
    arc(arcLipA, arcLipB, 70, 70, arcChord, PI, CHORD);//teeth

}

    function mousePressed(){
        //when user clicks, eye color changes
        rBlack = random(0, 285);
        gBlack = random(0, 285);
        bBlack = random(0, 285);
        //when user clicks, earring color changes
        rWhite = random(0, 285);
        gWhite = random(0, 285);
        bWhite = random(0, 285);
        //when user  clicks, hair and eyeliner change color
        rHair = random(0, 285);
        gHair = random(0, 285);
        bHair = random(0, 285);
        //when user clicks, eyebrow color changes
        rEyebrow = random(0, 285);
        gEyebrow = random(0, 285);
        bEyebrow = random(0, 285);
        //when user clicks, cheek color changes 
        rCheek = random(0, 285);
        gCheek = random(0, 285);
        bCheek = random(0, 285);
        //when user clicks, lip color changes
        rLip = random(0, 285);
        gLip = random(0, 285);
        bLip = random(0, 285);
        //when user clicks, nose color changes
        rNose = random(0, 285);
        gNose = random(0, 285);
        bNose = random(0, 285);
        //when user clicks, inner ear color changes
        rEar = random(0, 285);
        gEar = random(0, 285);
        bEar = random(0, 285);
        //when user clicks, face/neck color changes
        rFace = random(0, 285);
        gFace = random(0, 285);
        bFace = random(0, 285);
        //when user clicks, eye pupil size changes
        eyepupil = random (5, 30);
         //when user clicks, eyebrow position changes
        arcB = random(170, 215);
        //when user clicks, mouth position changes
        arcChord = random(0,100);
    
    }

GraceSimmons-Project02-VariableFaces

When I was making this face, my main focus was changing colors, but still keeping a cohesive looking piece. I thought it would be interesting to have imaginative colors for the eyes, but keep within a range of more realistic colors for the skintone. The ears stay within a range of brown, and the hair within a range of orange. By keeping the face size constant, the different identities were all dependent on the features shifting. This creates a very slight identity change sometimes, but it can also result in a starkly different visual appearance at other times.

sketch-73.js

var noseWidth   =30;
var noseHeight  =60;
var mouthWidth  =100;
var mouthHeight =30;
var earWidth    =30;
var earHeight   =50;
var hairWidth   =300;
var hairHeight  =200;
var ebWidth     =40; //eyebrow width
var ebHeight    =5;  //eyebrow height

//rgb for eyes
var eyeColor1   =72; //first rgb value
var eyeColor2   =136; //second rgb value
var eyeColor3   =216; //third rgb value

//rgb for face
var skinTone1   =240; 
var skinTone2   =200;
var skinTone3   =170;

//rgb for eyes
var earColor1   =150; 
var earColor2   =90;
var earColor3   =50;

//rgb for hair
var hairColor1  =240; 
var hairColor2  =120;
var hairColor3  =30;

var ebYaxis     =250; //to shift eyebrows up and down

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

function draw() {
	background(246,211,53);
	fill(hairColor1,hairColor2,hairColor3);
	stroke(hairColor1,hairColor2,hairColor3);
	ellipse(width/2,height/3,hairWidth,hairHeight); // hair bubble
	fill(earColor1,earColor2,earColor3);
	stroke(earColor1,earColor2,earColor3);
	rect(width/5,height/2.25,earWidth,earHeight); //left ear
	rect(3.57/5*width,height/2.25,earWidth,earHeight); //right ear
	fill(skinTone1,skinTone2,skinTone3);
	stroke(skinTone1,skinTone2,skinTone3);
	ellipse(width/2,height/2,width/2,height/2); //face
	fill(eyeColor1,eyeColor2,eyeColor3);
	stroke(eyeColor1,eyeColor2,eyeColor3);
	ellipse((4/10)*width,.45*height,.05*width,.05*height); //left eye
	ellipse((6/10)*width,.45*height,.05*width,.05*height); //right eye
	fill('red');
	stroke('red');
	ellipse(width/2,height/2*1.25,mouthWidth,mouthHeight); //mouth
	fill(255,110,150); 
	stroke(255,110,150);
	ellipse(width/2,height/2,noseWidth,noseHeight); //nose
	fill(148,120,95);
	stroke(148,120,95);
	ellipse((4/10)*width,ebYaxis,ebWidth,ebHeight); //left eyebrow
	ellipse((6/10)*width,ebYaxis,ebWidth,ebHeight); //right eyebrow
}

function mousePressed() {
	mouthWidth  = random(60,130);
	mouthHeight = random(05,70);
	noseWidth   = random(10,50);
	noseHeight  = random(20,90);
	eyeColor1   = random(170,255);
	eyeColor2   = random(130,203);
	eyeColor3   = random(150,255);
	skinTone1   = random(235,255);
	skinTone2   = random(195,215);
	skinTone3   = random(160,180);
	earWidth    = random(20,60);
	earHeight   = random(40,80);
	earColor1   = random(140,170);
	earColor2   = random(85,110);
	earColor3   = random(45,75);
	hairWidth   = random(200,400);
	hairHeight  = random(150,300);
	hairColor1  = random(235,255);
	hairColor2  = random(100,160);
	hairColor3  = random(0,55);
	ebWidth     = random(20,60);
	ebHeight    = random(3,10);
	ebYaxis     = random(230,280);
}

Soyun Kim – Project 02 – variable faces

newproject2

var faceWidth = 50; //w,h variables for face 
var faceHeight = 100;
var faceR = 172; //face color values
var faceG = 134;
var faceB = 94;

var eyes = 30; //variables for eyes
var eyesR = 102;
var eyesG = 178;
var eyesB = 102;

var earsWidth = 20; //variables for ears
var earsHeight = 40;
var earsR = 172;
var earsG = 134;
var earsB = 94;

var noseWidth = 15; //variables for nose
var noseHeight = 30;
var noseR = 188;
var noseG = 127;
var noseB = 126;

var pupil = 8; //variables for pupils
var pupilR = 66;
var pupilG = 16;
var pupilB = 16;

var mouthW = 60; //variables for mouth
var mouthH = 40;
var mouthR = 255;
var mouthG = 90;
var mouthB = 90;

var leftBrowX1 = 265; //variables for left eyebrow
var leftBrowY1 = 176;
var leftBrowX2 = 293;
var leftBrowY2 = 169;

var rightBrowX1 = 343; //variables for right eyebrow
var rightBrowY1 = 169;
var rightBrowX2 = 373;
var rightBrowY2 = 176;


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

}

function draw() {
    
	if (mouseX < width * 0.33) {      //background change colors depending on the mouse position
		background(129, 129, 255);
	} 
	else if (mouseX > width * 0.66) {
		background(206, 206, 102);
	} else {
		background(193, 132, 193);
	}



	var earA = width / 2.35 - faceWidth * 1.3;//left ear
	var earB = width / 1.75 + faceWidth * 1.3;//right ear
	noStroke();
	fill(earsR,earsG,earsB);
	ellipse(earA, height / 2.1, earsWidth*2, earsHeight*2);
	ellipse(earB, height / 2.1, earsWidth*2, earsHeight*2);


    noStroke();
	fill(faceR,faceG,faceB); //face
	ellipse(width/2, height/2, faceWidth*4, faceHeight*3);

	noStroke();
	fill(noseR,noseG,noseB);//nose
	ellipse(width/2, height/2.1, noseWidth, noseHeight*1.5);
	
	noStroke();
	var eyeA = width / 2 - faceWidth * 0.8;//left eye
	var eyeB = width / 2 + faceWidth * 0.8;//right eye
	fill(eyesR,eyesG,eyesB);
	ellipse(eyeA, height / 2.3, eyes, eyes);
	ellipse(eyeB, height / 2.3, eyes, eyes);
    
    var pupilA = width / 2 - faceWidth * 0.8;//left pupil
    var pupilB = width / 2 + faceWidth * 0.8;//right pupil
    fill(pupilR,pupilG,pupilB);
    ellipse(pupilA, height / 2.3, pupil, pupil);
    ellipse(pupilB, height / 2.3, pupil, pupil);

	fill(mouthR,mouthG,mouthB); //mouth
	arc(width/2, height/1.7, mouthW, mouthH, 0, PI); 

	strokeWeight(8);
	stroke(255,69,0);
	line(leftBrowX1,leftBrowY1,leftBrowX2,leftBrowY2);//left eyebrow
	line(rightBrowX1,rightBrowY1,rightBrowX2,rightBrowY2);//right eyebrow

}



function mousePressed() {
	
	faceWidth = random(40,95);
	faceHeight = random(50,150);
	faceR = random(190,165);
	faceG = random(150,127);
	faceB = random(110,87);

	eyes = random(15,48);
	eyesR = random(120,90);
    eyesG = random(198,158);
    eyesB = random(100,80);

	noseWidth = random(10,25);
	noseHeight = random(20,45);
	noseR = random(250,178);
    noseG = random(160,117);
    noseB = random(140,116);

    earsWidth = random(18,35);
    earsHeight = random(35,60);
    earsR = random(180,165);
    earsG = random(140,87);
    earsB = random(100,87);

    pupil = random(7,20);
    pupilR = random(170,80);
    pupilG = random(8,70);
    pupilB = random(7,100);

    mouthW = random(40,110);
    mouthH = random(25,83);
    mouthR = random(350,230);
    mouthG = random(50,130);
    mouthB = random(75,115);

    	
   
}

During this project, I realized the importance of organizing and commenting on my codes so it will not only be easier on others to see but for myself as well. Also, although it took awhile, I got familiar with the use of variables and random functions.

Grace- 02- Variable Face

sketch

//Grace Cha
//Section C
//heajinc@andrew.cmu.edu
//Project-02- Variable Face

//FOREHEAD CHANGE
var foreheadX = 119;

//EYEBROW CHANGES 
var eyebrowR = 313; //RIGHT EYEBROW
var eyebrowLX = 153;//LEFT EYEBROW
var eyebrowLY = 280;//LEFT EYEBROW

//NOSE TIP CHANGES
var noseTipX = 159;
var noseTipY = 364;

//BACKGROUND COLOR CHANGE
var backgroundR = 164;
var backgroundG = 219;
var backgroundB = 247;

//FACE COLORS CHANGE
var faceR = 164;
var faceG = 219;
var faceB = 247;

// TOP LIP CHANGE
var mouthTX = 179; 
var mouthTY = 423; 
var mouthBX = 185
var mouthBY = 432;

//LIP COLOR CHANGE
var lipColor = 111

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

    background(backgroundR, backgroundG, backgroundB);

    //HAIR
    fill(215,111,97);
    stroke("#F7FCFC");
    strokeWeight(4);
    ellipse(249,247,311);
    rect(94,232,123,498);
    noStroke();
    rect(96,229,126,50);//TO HIDE THE BORDER
    
    //BACK AND SHOULDERS
    fill("#99C5DB");
    quad(435,463,307,527,262,422,346,338);
    
    //FACE 
    fill( faceR, faceG, faceB);
    beginShape();
    curveVertex(346, 320);
    curveVertex(346, 376);
    curveVertex(256, 476);//chin
    curveVertex(212, 481);//chin
    curveVertex(120, 360);//123
    curveVertex(127, 320);
    curveVertex(111, 297);
    curveVertex(foreheadX, 178);
    curveVertex(148, 209);
    curveVertex(293, 267);
    endShape();


    //LEFT EYEBROW
    beginShape();
    curveVertex(150, 304);
    curveVertex(144, 293);
    curveVertex(125, 293);
    curveVertex(125, 301);
    curveVertex(132, 313);
    endShape(); 


    //NOSE
    stroke("#F7FCFC");
    strokeWeight(6);
    beginShape();
    curveVertex(105,287);
    curveVertex(112,280);
    curveVertex(123,270);
    curveVertex(eyebrowLX, eyebrowLY);
    curveVertex(175, 303);
    curveVertex(noseTipX, noseTipY); //
    curveVertex(166,378);
    curveVertex(177,385);
    curveVertex(189,385);
    curveVertex(216,374);
    endShape();

    //EAR
	fill("#9B958F");
    noStroke();
    quad(123,682,208,451,446,436,550,640);
    noStroke();
    fill('#A4DBF7');
    push();
    translate(300,300);
    rotate(-13);
    ellipse(0,0,63,70);
    pop();

    //MOUTH
    fill(215,lipColor,97);
    beginShape();
    curveVertex(mouthTX,mouthTY);
    curveVertex(191,413);
    curveVertex(232,418);
    curveVertex(210,432);
    curveVertex(mouthBX, mouthBY);
    endShape();

    //LEFT PUPIL
    push();
    strokeWeight(4);
    fill("#9B958F");
    translate(127,303); 
    rotate(18);
    ellipse(0,0, 11, 24);
    pop();

    //LEFT EYEBROW
    beginShape();
    fill("#9B958F");
    curveVertex(150, 304);
    curveVertex(144, 293);
    curveVertex(125, 293);
    curveVertex(125, 301);
    curveVertex(132, 313);
    endShape(); 

    //RIGHT EYEBROW
    stroke("#9B958F");
    strokeWeight(9);
    beginShape();
    curveVertex(180,eyebrowR);
    curveVertex(198, 277);
    curveVertex(217, 270);
    curveVertex(234, 270);
    curveVertex(260, 282);
    endShape();

    //RIGHT PUPIL
    push();
    strokeWeight(4);
    fill("#9B958F");
    translate(206, 290);
    rotate(18);
    ellipse(0,0,11,24);
    pop();

    //RIGHT UNDER EYE 
    beginShape();
    strokeWeight(4);
    curveVertex(210, 323);
    curveVertex(219, 309);
    curveVertex(236, 305);
    curveVertex(247,305);
    endShape();
}

    function mousePressed() {

    //FOREHEAD SIZE CHANGE
    foreheadX = random(119, 140);

    //EYEBROW CHANGE (right/left)
    eyebrowR = random(190, 315);
    eyebrowLX = random(153,170);
    eyebrowLY = random(280, 290);
    
    //MOUTH SIZE CHANGE (top lip)
    mouthTX = random(50, 200); 
    mouthTY = random(403, 450);
    
    //MOUTH SIZE CHANGE (bottome lip)
    mouthBX = random(170,200);
    mouthBY = random(420,450);
    
    //LIPCOLOR CHANGE
    lipColor = random(60,111);
    
    //BACKGROUND CHANGE
    backgroundR = random(100,180);
    backgroundG = random(220, 250);
    backgroundB = random(200, 250);

    //FACE COLOR CHANGE
    faceR = random(150, 180); 
    faceG = random(200, 220); 

    //NOSE LENGTH CHANGE
    noseTipX = random(140, 159);
    noseTipY = random(360, 364);
}
 


The Process

screen-shot-2016-09-08-at-4-44-57-pm

I wanted to continue the theme of using simple shapes to design the face as my previous project; however, in this face,  I used mostly the curveVertex(); function to draw curvy linear movements to things express emotions/feelings. I was inspired by “Girl with the Pearl Earring” painting/movie. haha.  It was pretty fun playing around with the curveVertex tool!