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.

Leave a Reply