Emma Nicklas-Morris Project-02 (Variable Face)

Emma’s Variable Faces

/* 
Emma Nicklas-Morris
Section B
enicklas@andrew.cmu.edu
Variable Faces
*/

var faceShapeX = 280;
var faceShapeY = 330;
var hairLen = 300;
var mouthW = 120;
var mouthH = 80;
var noseX1 = 215;
var noseY1 = 255;
var noseX2 = 240;
var noseY2 = 205;
var noseX3 = 265;
var noseY3 = 255;
let colors = ['blue', 'black', 'green', 'brown', 'grey'];
let color = 'black';
var bodyX = 200;
var bodyY = 400;
let bodColor = "red";
let bodColors = ['orange', 'yellow', 'navy', 'purple', 'pink'];

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

function draw() {
    background("lightblue");

    // Body
	fill(bodColor);
	ellipse(width/2, height - 50, bodyX, bodyY);

	// Face shape
	strokeWeight(0);
	fill('#E0AC69');
	ellipse(width / 2, width / 2, faceShapeX, faceShapeY);
	var eyeLX = width / 2 - faceShapeX * 0.25;
    var eyeRX = width / 2 + faceShapeX * 0.25;

	// Mouth
	fill('#E77471');
	strokeWeight(1);
	arc(width / 2, height/2, mouthW, mouthH, 0, PI); 

	// Nose 
	fill('#C58917');
	strokeWeight(0);
	triangle(noseX1, noseY1, noseX2, noseY2, noseX3, noseY1); 

	// White of eyes
	strokeWeight(2);
	fill('white');
	ellipse(eyeLX, height/4, 50, 25);  
	ellipse(eyeRX, height/4, 50, 25);

	// Pupils
	fill(color);
	ellipse(eyeLX, height/4, 20, 20);  
	ellipse(eyeRX, height/4, 20, 20);

	// Hair
	strokeWeight(0);
	arc(300, 155, 250, 230, PI + QUARTER_PI, TWO_PI + QUARTER_PI); 
	arc(260, 200, 340, 290, PI, PI + HALF_PI, OPEN);
	rect(360, 180, 65, hairLen);
	rect(80, 140, 45, hairLen + 40);

}

function mousePressed() {
	faceShapeX = random(230, 300);
	faceShapeY = random(320, 370);
	hairLen = random(100, 500);
	mouthW = random(10, 100);
	mouthH = random(10, 50);
	noseX1 = random(210, 220);
    noseY1 = random(250,260);
    noseX2 = random(235, 245);
    noseY2 = random(200, 210);
    noseX3 = random(260, 270);
    color = random(colors);
    bodColor = random(bodColors);
    bodyX = random(200, 300);
}

My process was to start with a hard coded face and then define variables and change them slightly. I think my final product is pretty good for someone who struggles with making illustrations AND faces. I struggled with trying to figure out how to change the hair more drastically as the facial shape changes than just changing the hair length.

Leave a Reply