Rachel Lee-Project-02-Variable-Face- Section E

Rachel Lee Variable Face

/* Rachel Lee
Section E
rwlee@andrew.cmu.edu
Project-02 (Variable Faces) */


var skinColor = 193; // skin color
var eyelidH = 133;
var eyeballSize = 126; //eye
var reflectionX = 302;
var hornsX1 = 228; //horns
var hornsY1 = 143;
var hornsX2 = 220;
var hornsY2 = 78;
var hornsX3 = 265;
var hornsY3 =114;
var faceSize = 300; //face
var eyelidX = 126; //eyelid
var eyelidY = 130;
var cornerLX = 250; //lip
var cornerY = 275;
var cornerRX = 370;

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

function draw() {
	background(100, 120, 170);
	noStroke();

    // horns
    fill(230, 215, 150);
    triangle(hornsX1, hornsY1, hornsX2, hornsY2, hornsX3, hornsY3);
    triangle(hornsX1 + (width * 0.5 - hornsX1) * 2, hornsY1, hornsX2 + (width * 0.5 - hornsX2) * 2, hornsY2, hornsX3 + (width * 0.5 - hornsX3) * 2, hornsY3);
	
	//face
	fill(163, skinColor, 58);
	ellipse(width * 0.5, height * 0.5, faceSize, faceSize); 

	//eyelid
	fill(70, 115, 50);
	ellipse(width * 0.5, 200, eyelidX, eyelidY); 
	
	//eye
	fill(255);
	ellipse(width * 0.5, 243 - faceSize * 0.1, eyeballSize, eyeballSize); 
	fill(60, 185, 165);
	ellipse(width * 0.5, 243 - faceSize * 0.1, eyeballSize * 0.5, eyeballSize * 0.5); 
	fill(0);
	ellipse(width * 0.5, 243 - faceSize * 0.1, eyeballSize * 0.3, eyeballSize * 0.3); 
	fill(255);
	ellipse(reflectionX, 243 - faceSize * 0.1, eyeballSize * 0.1, eyeballSize * 0.1);

	//mouth
	stroke(70, 115, 50);
	strokeWeight(2);
	noFill();
	curve(cornerLX, cornerY, cornerLX + 15, cornerY + 45, cornerRX + 15, cornerY + 35, cornerRX, cornerY);

}


function mousePressed() {
	faceSize = random (275, 325);
	eyeballSize = random (120, 145);
	// reflectionX = random (302, 320); 
	skinColor = random (160, 230);
	cornerY = random (280, 305);

}

For this project, I decided to try to recreate Mike Wazowski from my favourite Pixar movie, Monster’s Inc. While it took me a while to figure out some aspects of this composition, I really looked forward to seeing what kind of features would be randomly generated– it was rather exciting to play with.

Leave a Reply