Sarah Kang – Project 02 – Variable Face

ugly

//sarah kang
//section c
//sarahk1@andrew.cmu.edu
//project-02

var faceWidth = 180;
var earDim = 40;
var earhole = 20;
var eyebrows = 170;
var nostril = 7;
var hairlength = 30;
var hairR = 0;
var hairG = 0;
var hairB = 0;
var shirtR = 0;
var shirtG = 0;
var shirtB = 0;

function setup() {
	createCanvas(400, 400);
	background(255, 242, 246);
}

function draw() {
	noStroke();

	//body
	fill(shirtR, shirtB, shirtG);
	ellipse(200, 350, 100, 200);

	//ears
	fill('tan');
	ellipse(115, 200, earDim, earDim);
	ellipse(285, 200, earDim, earDim);
	fill(171, 133, 103);
	ellipse(115, 200, earhole, earhole);
	ellipse(285, 200, earhole, earhole);

	//face
	fill('tan');
	ellipse(200, 200, faceWidth, 180);

	//hair
	fill(hairR, hairG, hairB);
	rect(200, 100, 7, hairlength);

	//eyes 
	fill('white');
	ellipse(165, 200, 30, 15);
	ellipse(235, 200, 30, 15);
	fill('black');
	ellipse(165, 200, 15, 15);
	ellipse(235, 200, 15, 15);

	//nostrils
	ellipse(190, 220, nostril, nostril);
	ellipse(210, 220, nostril, nostril);

	//brows
	stroke(0);
	noFill();
	arc(165, eyebrows, 30, 10, PI, 0, OPEN);
	arc(235, eyebrows, 30, 10, PI, 0, OPEN);

	//mouth
	stroke(176, 60, 79);
	strokeWeight(2);
	arc(200, 240, 30, 30, 0, PI, CHORD);
}

function mousePressed(){
	faceWidth = random(180, 220);
	earDim = random(40, 100);
	earhole = random(40, 80);
	eyebrows = random(140, 180);
	hairlength = random(20, - 80);
	nostril = random(4, 14);
	hairR = random(0, 225);
	hairB = random(0, 225);
	hairG = random(0, 225);
	shirtR = random(0, 225);
	shirtB = random(0, 225);
	shirtG = random(0, 225);
}



I enjoyed playing around with different variables for my face. Adjusting the colors to only display certain shades that were still discernible was pretty difficult, so I decided to completely randomize the colors instead.

Leave a Reply