Jenni Lee – Project 02 – Variable Face

jenni-project-02

	//face variable
	var faceWidth = 220;
	var faceHeight = 220;
	var faceX = 211;
	var faceY = 133;
	var faceColor = 255;
	
	//eye variable
	var eyeWidth = 11;
	var eyeHeight = 11;
	var eyeX = 250;
	var eyeY = 235;

	//ear variable
	var earWidth = 44;
	var earHeight = 44;
	var earX = 210;
	var earY = 133;

	//nose variable
	var noseWidth = 28;
	var noseHeight = 20;
	var noseX = 306;
	var noseY = 246;

	//blush variable
	var blushWidth = 13;
	var blushHeight = 9;
	var blushX = 260;
	var blushY = 254;


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

}

function draw() {
	background(249, 234, 242);

	//drawing face
	noStroke();
	fill(faceColor);
	ellipseMode(CORNER);
	ellipse(faceX, faceY, faceWidth, faceHeight);

	//drawing eyes
	noStroke();
	fill(112);
	ellipseMode(CORNER);
	ellipse(eyeX, eyeY, eyeWidth, eyeHeight);

	//drawing right eye
	noStroke();
	fill(112);
	ellipseMode(CORNER);
	ellipse(eyeX+130, eyeY, eyeWidth, eyeHeight);

	//drawing left blush
	noStroke();
	fill(255, 204, 213);
	ellipseMode(CORNER);
	ellipse(blushX, blushY, blushWidth, blushHeight);

	//drawing right blush
	noStroke();
	fill(255, 204, 213);
	ellipseMode(CORNER);
	ellipse(blushX+105, blushY, blushWidth, blushHeight);

	//drawing nose
	noStroke();
	fill(112);
	ellipseMode(CORNER);
	ellipse(noseX, noseY, noseWidth, noseHeight);

	//drawing left ear
	noStroke();
	fill(255);
	ellipseMode(CORNER);
	ellipse(earX, earY, earWidth, earHeight);

	//drawing right ear
	noStroke();
	fill(255)
	ellipseMode(CORNER);
	ellipse(earX+179, earY, earWidth, earHeight);

}

function mousePressed() {

	//randomizing eye size
	eyeHeight = random (8, 15);
	eyeWidth = random (11, 15);

	//randomizing face size
	faceHeight = random (220, 300);
	
	//randomizing ear size
	earHeight = random (20, 44);

	//randomizing face color
	faceColor = random (220, 255);

	//randomozing nose size
	noseHeight = random (14, 20);
}

Although many aspects of this project took me a while to figure out, ultimately it was really fun to customize and it was a good learning experience. I based my variable face on one of my favorite stuffed animals.

Curran Zhang- Project 2- Variable Faces

sketch

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

var c1=0;
var c2=100;
var c3= 150;
var eyeSize = 20;
var faceWidth = 150;
var faceHeight = 150;
var faceWide= 100;
var faceHigh=100;
var bodyWidth=150;
var bodyHeight= 300;
var armLength= 150;
var bodyWide=100
var bodyHigh=200

function draw() {
    background(c1,c2,c3);

//Venom
    fill(0)
    ellipse(width / 4-40, height / 3, faceWidth,  faceHeight);
    var eyeL = width / 4 - faceWidth * 0.25;
    var eyeR = width / 4 + faceWidth * 0.25;
    //Face
    fill(250);
    arc(eyeL-40,height/3, 3*eyeSize,3*eyeSize,QUARTER_PI,PI+QUARTER_PI); 
    fill(250);
    arc(eyeR-40,height/3, 3*eyeSize,3*eyeSize,PI+QUARTER_PI+HALF_PI,HALF_PI+QUARTER_PI); 
    //Body
    fill(0);
    rect(width/4-bodyWidth/2-40,height/3+faceHeight/2,bodyWidth,bodyHeight,40)
    fill(250);
    quad(width/4-bodyWidth/2-40,height/3+faceHeight/2+40, 
         width/4-bodyWidth/2-40,height/3+faceHeight/2+bodyHeight/3+40,
         width/4+bodyWidth/2-40,height/3+faceHeight/2+40, 
         width/4+bodyWidth/2-40,height/3+faceHeight/2+bodyHeight/3+40)
    //Arm
    fill(0);
    rect(width/4+bodyWidth/2-40,height/3+faceHeight/2+30, armLength,50,40)


//Spidey
    fill('red');
    ellipse(3*width / 4, height / 2, faceWide,  faceHigh);
    noStroke();
    var eyeLL = 3*width / 4 - faceWide * 0.25;
    var eyeRR = 3*width / 4 + faceWide * 0.25;
    //Face
    fill(0);
    arc(eyeLL,height/2, 3*eyeSize+5,3*eyeSize+5,QUARTER_PI,PI+QUARTER_PI);
    fill(250);
    stroke('black');
    strokeWeight(1.5);
    arc(eyeLL,height/2, 3*eyeSize,3*eyeSize,QUARTER_PI,PI+QUARTER_PI); 
    fill(0);
    arc(eyeRR,height/2, 3*eyeSize+5,3*eyeSize+5,PI+QUARTER_PI+HALF_PI,HALF_PI+QUARTER_PI); 
    fill(250);
    stroke('black');
    strokeWeight(1.5);
    arc(eyeRR,height/2, 3*eyeSize,3*eyeSize,PI+QUARTER_PI+HALF_PI,HALF_PI+QUARTER_PI); 
    fill('red');
    rect(3*width/4 - bodyWide/2,height/2+faceHigh/2,bodyWide,bodyHigh,40);
    //Body
    fill('black');
    quad(3*width/4 - bodyWide/2, height/2+faceHeight/2+45, 
         3*width/4 - bodyWide/2, height/2+faceHeight/2+bodyHigh/3+45, 
         3*width/4 + bodyWide/2,  height/2+faceHeight/2+45,
         3*width/4 + bodyWide/2,  height/2+faceHeight/2+bodyHigh/3+45);

    ellipse(3*width/4, height/2+faceHeight/2+40+bodyHigh/6, 40 );
    fill('red');
    rect(width/4+bodyWidth/2-40,height/3+faceHeight/2+130,(3*width/4-bodyWide/2)-(width/4+bodyWidth/2-40),50,40);
}

function mousePressed() {
    faceWidth = random(100, 150);
    faceHeight = random(100, 150);
    eyeSize = random(10, 25);
    bodyWidth=random(150,200);
    bodyHeight=random(300,350);
    armLength=random(120,185);
    bodyWide=random(100,150);
    bodyHigh=random(200,250);
    c1= random(0,225);
    c2= random(0,222);
    c3= random(0,255);
    faceWide= random(100,150);
    faceHigh= random(100,150);
}


I was inspired to do a Spider-man vs Venom scene after seeing clips of them on YouTube. I wanted to use the variables to choreography some sort of fight scene. But due to the large amount of details, I simplified the designs of both characters and applied a changing variable on there arms to hint the “fight”.

Philip Gates – Project-02-Variable-Face

gates-face2

//initialize variables to be randomized
var faceWidth = 480;
var eyeSize = 240;
var eyeColorR = 19;
var eyeColorG = 175;
var eyeColorB = 26;
var noseSize = 350;
var stacheWidth = 3;

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

function draw() {

    background(255);

    //head
    fill(242,208,239);
    noStroke();
    ellipse(240,240,faceWidth,640);

    //eyes
    stroke (0);
    strokeWeight (1);
    fill(255);
    ellipse(144,240,eyeSize,eyeSize);
    ellipse(336,240,eyeSize,eyeSize);

    //iris
    fill(eyeColorR, eyeColorG, eyeColorB);
    noStroke();
    ellipse(144, 240, eyeSize / 2, eyeSize /2);
    ellipse(336, 240, eyeSize / 2, eyeSize /2);

    //pupils
    fill(0)
    noStroke();
    ellipse(144,240,eyeSize/5,eyeSize/5);
    ellipse(336,240,eyeSize/5,eyeSize/5);

    //nose
    fill(218,0,165);
    triangle (240,noseSize,216,425,264,425);

    //mustache
    stroke(40,17,0);
    strokeWeight(stacheWidth);
    line(80,441,80,466);
    line(90,444,90,469);
    line(100,447,100,472);
    line(110,450,110,475);
    line(120,453,120,478);
    line(130,454,130,480);
    line(140,456,140,482);
    line(150,458,150,484);
    line(160,459,160,485);
    line(170,460,170,486);
    line(180,461,180,487);
    line(190,462,190,488);
    line(200,463,200,489);
    line(210,463,210,489);
    line(220,463,220,489);
    line(230,463,230,489);
    line(240,463,240,489);
    line(250,463,250,489);
    line(260,463,260,489);
    line(270,463,270,489);
    line(280,463,280,489);
    line(290,462,290,488);
    line(300,461,300,487);
    line(310,460,310,486);
    line(320,459,320,485);
    line(330,458,330,484);
    line(340,456,340,482);
    line(350,454,350,480);
    line(360,453,360,478);
    line(370,450,370,475);
    line(380,447,380,472);
    line(390,444,390,469);
    line(400,441,400,466);

    //mouth
    noFill();
    stroke(218,0,165);
    strokeWeight(5);
    arc(240,345,576,310,0,PI);

    //hat
    fill(0);
    noStroke();
    arc(240,0,350,200,0,PI);
}

//change face dimensions when mouse is clicked
function mousePressed() {
    faceWidth = random(200,480);
    eyeSize = random(50, 288);
    eyeColorR = random(0,255);
    eyeColorG = random(0,255);
    eyeColorB = random(0,255);
    noseSize = random(300,450);
    stacheWidth = random(0,15);
}

I chose to continue working with my face project from last week. In doing so, I learned why hard-coding numbers can make things difficult down the line: when I changed the canvas size my face didn’t fit in the frame, and after changing that I needed to adjust quite a few numbers to make the proportions match on the facial features. In future I will plan to create more variables and do much less hard-coding of numbers.

Adam He Project 02 Variable Faces

sketch

/* Adam He
Section A
xiaotiah@andrew.cmu.edu
Project-02 */

// shape variables
var faceW = 280;
var faceH = 380;
var eyeSize = 50;
var mouthSize = 70;
var noseH = 70;
var noseW = 30;
// color variables
var mouthColor = 200;
var skinColor = 220;
var eyeColor = 80;


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

function draw() {
    background(220, 50, 120);
    noStroke();
    // hair
    fill(70,20,130);
    ellipse(width/2, height/2.5, faceW*1.2, faceH/2);
    // drawing face
    fill(skinColor, 180, 95);
    ellipse(width/2, height/2, faceW, faceH);
    // eye
    fill(240);
    ellipse(width / 2 - 0.2 * faceW, height / 2, eyeSize, eyeSize);
    ellipse(width / 2 + 0.2 * faceW, height / 2, eyeSize, eyeSize);
    // pupils
    fill(50, 60, eyeColor);
    ellipse(width / 2 - 0.2 * faceW, height / 2.1, eyeSize / 3, eyeSize / 3);
    ellipse(width / 2+ 0.2 * faceW, height / 2.1, eyeSize / 3, eyeSize / 3);
    // nose
    fill(skinColor, 20, 170);
    rect(width / 2 - noseW / 2, height / 1.8, noseW, noseH);
    // mouth
    fill(mouthColor, 20, 80);
    ellipse(width / 2, height / 2 + faceH / 2.5, mouthSize * 1.4, mouthSize);
}

function mousePressed() {
    faceW = random(200, 320);
    faceH = random(250, 400);
    eyeSize = random(30, 100);
    mouthSize = random(20, 100);
    skinColor = random(150, 220);
    eyeColor = random(20, 180);
    noseH = random(20,100);
    noseW = random(10, 40);
    mouthColor = random(100, 255);
}

This project was more interesting than the previous project because variable faces create an interactive platform between the developer and the viewers. A lot of interfaces are meant to produce an interlinked space between different people, and I am glad that I scripted something a little closer to that kind of program.

Jamie Dorst Project 02 Variable Faces

sketch

/*
Jamie Dorst
Section A
jdorst@andrew.cmu.edu
project-02
*/

// variables
var eyeSize = 20;
var faceWidth = 150;
var faceHeight = 180;
var r, g, b
var faceCorners = 120
var irisSize = 15;
var eyeR, eyeG, eyeB
var pupilSize = 12
var mouthWidth = 50
var mouthHeight = 25
var noseWidth = 15
var noseHeight = 10
var mouthR, mouthG, mouthB
 
function setup() {
    createCanvas(640, 480);

    // choose random canvas starting color
    r = random(255);
    g = random(255);
    b = random(255);

    // choose random eye starting color
    eyeR = random(255);
    eyeG = random(255);
    eyeB = random(255);

    // choose random mouth starting color
    //reddish hue
    mouthR = random(51, 255);
    mouthG = random(204);
    mouthB = random(204);
}
 
function draw() {
    noStroke();
    background(r, g, b);

    // face
    fill('#EAC086');
    rectMode(CENTER);
    rect(width / 2, height / 2, faceWidth, faceHeight, faceCorners, faceCorners, faceCorners, faceCorners);

    // eyes
    // whites
    fill('white');
    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);
    // iris
    fill(eyeR, eyeG, eyeB);
    ellipse(eyeLX, height / 2, irisSize, irisSize);
    ellipse(eyeRX, height / 2, irisSize, irisSize);
    // pupil
    fill('black');
    ellipse(eyeLX, height / 2, pupilSize, pupilSize);
    ellipse(eyeRX, height / 2, pupilSize, pupilSize);

    // mouth
    noFill();
    strokeWeight(4);
    strokeCap(ROUND);
    stroke(mouthR, mouthG, mouthB);
    arc(width / 2, height / 2 + .25 * faceHeight, mouthWidth, mouthHeight, 0, PI);

    // nose
    stroke(51);
    strokeWeight(2);
    arc(width / 2, height / 2 + .1 * faceHeight, noseWidth, noseHeight, 0, PI);
}
 
function mousePressed() {
    // randomize sizes, colors upon click
    faceHeight = random(120, 220);
    faceWidth = random(100, faceHeight);
    eyeSize = random(10, 30);
    r = random(255);
    g = random(255);
    b = random(255);
    faceCorners = random (80, 140);
    irisSize = random(5, eyeSize - 1);
    eyeR = random(255);
    eyeG = random(255);
    eyeB = random(255);
    pupilSize = random(1, irisSize - 1);
    mouthWidth = random(5, 90);
    mouthHeight = random(2, 40);
    noseWidth, noseHeight = random(5, 25);
    mouthR = random(51, 255);
    mouthG = random(0, mouthR - 50);
    mouthB = random(0, mouthR - 50);

}

For this project, I started with the template that was given and added some of my code from last week’s face project to create a base face. Then I added in some variables, thought about what to change, and ended up finding a way to have sizes change but keep them relatively proportional (ie. have the size of the pupil change but not have it be bigger than the iris). I also found it fun to change colors and learn how to randomize something like that where it’s not as simple as a range of two numbers.

susiel-project02-variableFACE

sketch

/* 
Susie Lee
Section E
susiel@andrew.cmu.edu
Project-02
*/
//snowman feature variables
	//sky+shadow colours
var cR=231;
var cG=234;
var cB=241;
	//arm stroke thickness
var ARM=5;
	//blueberry buttons
var button=20;
	//snowman body
var bodyWidth = 170;
var bodyHeight = 150;
	//snowman face
var faceWidth = 100;
var faceHeight = 100;
var eyeSize=10;
var eyeBROW=20;
	//carrot colours
var carrotR= 255;
var carrotG= 143;
var carrotB= 28;


//setting landscape
function setup() {
    createCanvas(480, 640);
}

//setting base snowman
function draw() {
	noStroke();
    //skyRandom+Ground
    background(cR, cG, cB);
    fill(255);
    ellipse(240,640,800,600);
    //snowmanSHADOW
    fill(240, 246, 247,95);
    ellipse(width/2,(height/2)+bodyHeight/2,bodyHeight,bodyWidth);
    //snowmanARMS
    stroke(146, 109, 57);
    strokeWeight(ARM);
    line(width/2, height/2, width/3, height/2-bodyHeight/1.75);
    line(width/2, height/2, width/2+width/6, height/2-bodyHeight/1.75);
    //snowmanBody
    noStroke();
    fill(255);
    ellipse(width/2, height/2, bodyWidth, bodyHeight);
    //buttons
    fill (43, 62, 133);
    var buttonTOP = (height/2) - bodyHeight*0.25;
    var buttonMIDDLE = (height/2);
    var buttonBOTTOM = (height/2) + bodyHeight * 0.25;
	ellipse(width/2, buttonTOP, button, button);
    ellipse(width/2, buttonMIDDLE, button, button);
    ellipse(width/2, buttonBOTTOM, button, button);
    //snowmanHEAD SHADOW
    fill(cR,cG,cB,85);
    ellipse(width/2, height/2-bodyHeight/1.9, faceWidth, faceHeight);
    //snowmanHEAD
    fill(255);
    ellipse(width/2, height/2-bodyHeight/1.75, faceWidth, faceHeight);
    //snowmanFACE
    	//eyes
    fill(0);
    var eyeLX = width / 2 - faceWidth * 0.25;
    var eyeRX = width / 2 + faceWidth * 0.25;
    ellipse(eyeLX, height / 2-bodyHeight/1.75, eyeSize, eyeSize);
    ellipse(eyeRX, height / 2-bodyHeight/1.75, eyeSize, eyeSize);
    	//eyebrow
    var eyebrowL = width / 2 - faceWidth * 0.25;
    var eyebrowR = width / 2 + faceWidth * 0.25;
    rect (eyebrowL-10, height / 2-bodyHeight/1.5, eyeBROW, eyeBROW/3);
    rect (eyebrowR-10, height / 2-bodyHeight/1.5, eyeBROW, eyeBROW/3);
    	//nose
    fill(carrotR, carrotG, carrotB);
    triangle (width/2, height/2-bodyHeight/1.75, width/2-10, height/2-bodyHeight/2, width/2+30, height/2-bodyHeight/2);

}

function mousePressed(){
	cR=random(220,240);
	cG=random(230,240);
	cB=random(230, 245);
	ARM=random(5,10);
    bodyWidth = random(75,150);
    bodyHeight=random(100,200);
    button=random(10,30);
    faceWidth = random (75,150);
    faceHeight = random(75, 150);
    carrotR=random(200,255);
    carrotG=random(140,200);
    carrotB=random(25,60);

}

Sketch

Rather than building on the last project, I wanted to create a variable snowman. This is because I love building snowmen. Since the 8th grade, my current college housemate and I build a snowman on the same day every year (weather permitting). I was inspired aesthetically by one of the snowman I built back in high school. His name is Pingu, a 2 mound snowman with blueberries for buttons, and a carrot nose that is a tad too large for him.

 

Jenna Kim (Jeeyoon Kim)- Project 2- Variable Faces

jennakim2

/* Jenna Kim (Jeeyoon Kim)
Section E
jeeyoonk@andrew.cmu.edu
Project 2
*/

// variability
var faceX = 318;
var faceY = 257;
var faceWidth = 250;
var faceHeight = 200;

var faceColorR = 255;
var faceColorG = 177;
var faceColorB = 162;

var eyeX = 279;
var eyeY = 240;
var eyeColorR = 255;
var eyeColorG = 163;
var eyeColorB = 46;
var eyeWidth = 25;

var earX = 195;
var earY = 253;
var earWidth = 50;
var earHeight = 50;

var noseX1 = 322;
var noseY1 = 244;
var noseX2 = 302;
var noseY2 = 272;
var noseX3 = 340;
var noseY3 = 272;

var musX = 300;
var musY = 280;
var musWidth = 40;
var musHeight = 10;

var hatX = 318;
var hatY = 158;
var hatcircleX = 320;
var hatCircleY = 140;

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

function draw() {
    background(faceWidth, 230, faceHeight);  
    
    //face
    noStroke();
    fill(faceColorR, faceColorG, faceColorB);
    ellipse(faceX, faceY, faceWidth, faceHeight);

    //left eye
    noStroke();
    fill(eyeColorR, eyeColorG, eyeColorB);
    ellipse(eyeX, eyeY, eyeWidth, eyeWidth);

    //right eye
    noStroke();
    fill(eyeColorR, eyeColorG, eyeColorB);
    ellipse(eyeX + 80, eyeY, eyeWidth, eyeWidth);

    //left ear
    noStroke();
    fill(faceColorR, faceColorG, faceColorB);
    ellipse(earX, earY, earWidth, earHeight);

    //right ear
    noStroke();
    fill(faceColorR, faceColorG, faceColorB);
    ellipse(earX * 2.3, earY, earWidth, earHeight);

    //nose
    noStroke();
    fill(200);
    triangle(noseX1, noseY1, noseX2, noseY2, noseX3, noseY3);

    //mustache
    noStroke();
    fill(0);
    rect(musX, musY, musWidth, musHeight);

    //hat
    noStroke();
    fill(0);
    ellipse(hatX, hatY, faceWidth * 1/2, faceHeight * 1/7);
    noStroke();
    fill(0);
    ellipse(hatcircleX, hatCircleY, earX * 0.1, earY * 0.1);
}

function mousePressed() {
    //random eye color
    eyeColorR = random(0, 255);
    eyeColorG = random(0, 255);
    eyeColorB = random(0, 255);

    // random eye size
    eyeWidth = random(10, 40);

    //random ear size
    earWidth = random(45, 75);
    earHeight = random(45, 75);

}

It was fun to combine what we learned last week and this week to create a
face. “function mousePressed() {}” will definitely be an important tool
for my future design projects.

Sarah Yae – Project 02 – Variable Face

sketch

//Sarah Yae
//Section B
//smyae@andrew.cmu.edu
//Project-02

var faceX = 240
var faceY = 320
var facecolor = 255

var earX = 180
var earY = 200
var earlength = 60
var earwidth = 60

var eyeX = 200
var eyeY = 300
var eyecolor = 120

var noseX = 240
var noseY = 340
var nosewidth = 10

var mouth = 80
var mouthx1 = 200
var mouthx2 = 280

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

function draw() {
	background (255,229,204);

//draws the face in first frame
	noStroke();
	fill(facecolor);
	ellipse (faceX, faceY,230,230);

//draws the left ear in first frame
	noStroke();
	fill(facecolor);
	ellipse (earX, earY, earwidth, earlength);

//draws the right ear in first frame
    noStroke();
    fill(facecolor);
    ellipse (earX + 120, earY, earwidth, earlength);

//draws the left eye in first frame
    noStroke();
    fill (eyecolor);
    ellipse (eyeX, eyeY, 40, 40);

//draws the right eye in first frame
    noStroke();
    fill(eyecolor);
    ellipse (eyeX + 80, eyeY,40,40);

//draws the nose in first frame 
    noStroke();
    fill (204,204,255);
    ellipse (noseX, noseY, nosewidth, 30);

//draws the mouth in first frame 
    noStroke();
    fill (255,204,204);
    triangle (mouthx1,370,mouthx2,370,240,400);

}

function mousePressed() {

//face changes color
    faceX = 240;
    faceY = 320;
    facecolor = random(140,255);

//ears changes size (lengths and widths)
    earX = 180;
    earY = 200;
    earlength = random(50,130);
    earwidth = random(50,100);

//eyes changes color 
    eyeX = 200;
    eyeY = 300;
    eyecolor = random (10,120);

//nose changes size (width)
    noseX = 240;
    noseY = 340;
    nosewidth = random(10,40);

//mouth changes size (width)
    mouth = 80;
    mouthx1 = random (180,220);
    mouthx2 = random (260,300);

}

I wanted to create a cute, fantasy creature. By pressing the mouse, you can see my animal switch up from a mouse, a bunny, a bear, etc… you name it!

Han Yu Project 2 Variable Face

sketch

// Han Yu
// Section D
// hyu1@andrew.cmu.edu
// Project-02

var facew = 200
var faceh = 200
var color1 = 219 
var color2 = 255
var color3 = 238
var eyesize = 5
var pupildiff = 40
var mouthopen = 10

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

function draw() {
	background(219,255,238);
	//bubbles
	noFill();
	ellipse(500,80,180,120);
	ellipse(480,180,50,35);
	//word
    textSize(35);
    strokeWeight(4);
	text("wut?",470,100);
	//face
	fill(219,255,238);
	stroke(249,192,180);
	strokeWeight(6);
	rect(width*0.2,height*0.15,facew,faceh,10);
	//body
	rect(width*0.4,height*0.15+faceh,facew*0.7,300,10);
	//book
	fill(color1,color2,color3);
	rect(width*0.4*0.8,(height*0.15+faceh)*1.3,facew*0.7*0.8,200,10);
	//eye
	fill(249,192,180);
	stroke(249,192,180);
	strokeWeight(6);
	ellipse(width*0.2+facew/5,height*0.15+faceh/4,eyesize,eyesize);
    ellipse(width*0.2+facew/5+pupildiff,height*0.15+faceh/4,eyesize,eyesize);
	//mouth
	fill(254,225,124);
	rect(width*0.2+facew/4,height*0.15+faceh/3,facew/2,faceh/2+mouthopen,10);
	//teeth
	fill(255);
	rect(width*0.2+facew/3.5,height*0.15+faceh/3,facew/8,faceh/10,10);
	rect(width*0.2+facew/3.5+(facew/2)*0.6,height*0.15+faceh/3,facew/8,faceh/10,10);
}


function mousePressed() {
    facew = random(150,300);
    faceh = random(150,280);
    color1 = random(165,255);
    color2 = random(165,255);
    color3 = random(195,255);
    eyesize = random(5,22);
    pupildiff = random(40,100);
    mouthopen = random(-50,20);
}

I was inspired by Domo the brown monster when I first started my project. But later I decided to make a meme-like character with a melodramatic expression while doing something. Overall, I feel like this project is challenging but enjoyable.

Victoria Reiter Project-02-Variable-Face

sketch

/*Victoria Reiter
Section B
vreiter@andrew.cmu.edu
Project-02-Variable-Face
*/

// defines coordinate position of freckle
var freckleX = 285;
var freckleY = 335;
// defines an increment value to be used under function mouseClicked()
var increment = 5;
// defines dimensions of pupils
var pupilWidth = 30;
var pupilHeight = 30;
// defines dimensions of the whites of the eyes
var whiteEyeWidth = 80;
var whiteEyeHeight = 80;
// defines dimensions of the irises of the eyes
var irisWidth = 55;
var irisHeight = 55;
// defines coordinates of the "point" of the nose
var pointyNoseX = 220;
var pointyNoseY = 325;
// defines y coordinates of the ears and inner ears
var earY = 260;
var innerEarY = earY + 5;
// defines dimensions of the mouth
var mouthWidth = 110;
var mouthHeight = 70;
// declares RGB values for hair
var hairColorR = 255;
var hairColorG = 255;
var hairColorB = 0;
// declares RGB values for irises of eyes
var irisColorR = 0;
var irisColorG = 102;
var irisColorB = 102;
// declares RGB values for hat
var hatColorR = 0;
var hatColorG = 76;
var hatColorB = 153;
// declares RGB values for hat band
var hatBandColorR = 0;
var hatBandColorG = 0;
var hatBandColorB = 51;

function setup() {
    // establishes canvas
    createCanvas(640, 480);
    background(220);
    // establishes background color
    background('rgb(153, 255, 204)');
    // writes a short message
    text("~V's Self-Portrait~", 10, 15);
}
function draw() {
    // reestablishes background now in dunction (draw)
    background(220);
    background('rgb(153, 255, 204)');
    noStroke();
    // Skin color
    fill('rgb(255,204,153)'); 
    //head
    ellipse(250, 285, 270, 290); 
    //ears
    ellipse(385,earY,50,70);
    ellipse(115,earY,50,70);
    noStroke();
    // inner ear color
    fill('rgb(255, 153, 153)'); 
    //inner ears
    ellipse(390,earY,30,50);
    ellipse(110,earY,30,50);
    //nose
    triangle(255,331,240,350,pointyNoseX,pointyNoseY);
    noStroke();
    // cheek blush color
    fill(255,204,204); 
    // cheek blush
    ellipse(185,335,60,25);
    ellipse(315,335,60,25);
    noStroke();
    // hairColor
    fill(hairColorR,hairColorG,hairColorB); 
    // hair
    quad(145,175,190,175,165,265,125,230);
    quad(180,175,215,175,245,260,230,245);
    quad(260,175,305,175,315,255,285,235);
    quad(315,175,355,175,370,220,335,245);
    noStroke();
    // hat color
    fill(hatColorR,hatColorG,hatColorB); 
    //hat
    ellipse(250, 190, 300, 75); 
    ellipse(210,140,110,150);
    ellipse(292,140,110,150);
    noStroke();
    // hat band color
    fill(hatBandColorR,hatBandColorG,hatBandColorB); 
    // hat band
    rect(155,152.5,192,30);
    // eye outline color
    stroke('rgb(0,158,255)');
    // white of eyes color
    fill('rgb(255, 255, 255)');
    // white of eyes
    ellipse(200,285,whiteEyeWidth,whiteEyeHeight);
    ellipse(305,285,whiteEyeWidth,whiteEyeHeight);
    // outline of mouth color
    stroke('rgb(102,0,51)');
    // mouth
    arc(250,360,mouthWidth,mouthHeight,0,PI,CHORD);
    noStroke();
    // irises
    fill(irisColorR,irisColorG,irisColorB);
    ellipse(200,272,irisWidth,irisHeight);
    ellipse(305,272,irisWidth,irisHeight);
    noStroke();
    // pupils
    fill('rgb(0,0,0)');
    ellipse(200,260,pupilWidth,pupilHeight);
    ellipse(305,260,pupilWidth,pupilHeight);
    noStroke();
    // freckle color
    fill('rgb(153,76,0)');
    // freckle
    ellipse(freckleX,freckleY,10,10);
}
    function mouseClicked() {
    // makes random variations occur in the portrait
    // moves freckle randomly about the face
    freckleX = random(150,350);
    freckleY = random(325,375);
    // changes size of the whites of eyes, pupils, and irises
    whiteEyeWidth = random(80,110);
    whiteEyeHeight = random(80,110);
    irisWidth = random(60,75);
    irisHeight = random(60,75);
    pupilWidth = random(25,55);
    pupilHeight = random(25,55);
    // changes nose shape or "pointiness"
    pointNoseX = random(185,245);
    pointyNoseY = random(305,345);
    // moves the ears up and down
    earY = random(250,270);
    // changes size of the mouth
    mouthWidth = random(40,150);
    mouthHeight = random(25,95);
    // changes color of the hair (warm colors)
    hairColorR = random(155,255);
    hairColorG = random(155,255);
    // changes color of the irises (cool colors)
    irisColorR = random(0,155);
    irisColorG = random(155,200);
    irisColorB = random(155,255);
    // changes color of the hat (completely random)
    hatColorR = random(0,255);
    hatColorG = random(0,255);
    hatColorB = random(0,255);
    // changes color of the hat band (grey scale)
    hatBandColorR = random(0,255);
    hatBandColorG = hatBandColorR;
    hatBandColorB = hatBandColorG;
}

In this project, I adapted my face from the week 1 project, and selected several variables to change randomly/within constraints. With a click of the mouse, my freckle moves across the screen, the sizes of the whites of my eyes, irises, and pupils change, the pointiness of my nose changes, my ears move up and down, my mouth changes size, my hair changes color (but sticks to warm colors), my irises change color (but stick to cool colors), my hat changes color randomly, and the band of my hat changes color along a grey scale.

I decided to use the basis of my face from the first project because I knew I would already have a LOT of difficulty figuring out the mechanics of this week’s task. And I did !!! I had no idea what was going on !!!!!!! So an immense enormous thank you to help from TAs Rain and Simin, who helped explain to me some concepts of how variables work and how declaring them and assigning them can be util for this and future tasks.

Furthermore, I adapted my code by adding in comments which I did not include in week one, cleaning up indentations and semicolons, and switching from hsl to rgb because I think it is a little easier to use and helpful for this project.

(((Again, THANK YOU TAs, I AM LESS HOPELESS WITH YOUR HELP)))