AudreyZheng-Project02

sketch

/*
Audrey Zheng
Section A
audreyz@andrew.cmu.edu
Assignment-01
*/


var hair_length = 240;
var face_length = 193;
var hair_color = 72;
var eye_pupil = 18;
var cheek = 17;

function setup() {
    createCanvas(468, 584);
}

function draw() {





	background(220);

	//hair
	noStroke();
	fill(hair_color,15,15);
	rect(121,108,215,hair_length,100,100,20,20);


	//body
	noStroke();
	fill(200);
	rect(128,340,206,161, 50);

	//neck
	fill(221,169,112);
	rect(206,305,50,69,20);
	fill(250,194,133);
	rect(218,325,38,49,20);

	//ear
	fill(250,194,133);
	ellipseMode(CORNER);
	ellipse(130,220,38,47);
	ellipse(292,220,38,47);


	//earshadows
	fill(231,165,93);
	ellipse(138,228,27,33);
	ellipse(295,227,27,33);


	//face
	fill(250,194,133);
	rect(149,132,162,face_length,100);

	//bangs
	fill(hair_color,15,15);
	//arc(x, y, w, h, start, stop, [mode])
	arc(185, 120, 150, 80, 0, PI + QUARTER_PI + QUARTER_PI, OPEN);
	arc(98, 55, 100, 150, 0, HALF_PI + QUARTER_PI - 0.5,OPEN); //it goes counter clock-wise

	//eyes
	fill(255);
	rect(172,229,31,23,12);
	rect(254,229,31,23,12);
	fill(0);
	ellipse(179,229,18,eye_pupil);
	ellipse(260,229,18,eye_pupil);

	//nose
	fill(231,165,93);
	triangle(230, 251, 224, 270, 236, 270);

	//eyeliner
	noFill();
	stroke(90, 60, 50);
	strokeWeight(6);
	arc(170, 230, 40, 10, 3.24, 6, OPEN);
	arc(250, 230, 40, 10, 3.33, 6.1, OPEN);

	//cheeks
	noStroke();
	fill(255,172,172);
	rect(160,270,25,cheek,8);
	rect(277,270,25,cheek,8);

	//eyebrows
	stroke(hair_color,15,15);

	strokeWeight(12.0);
	strokeCap(ROUND);
	line(171, 206, 201, 201);
	line(260.5,202.5,291.45,207.81);

	//mouth

	 p2 = { x: 253, y: 254 };
	var p3 = { x: 253, y: 291 },
	 p4 = { x: 215, y: 295 };
	noFill();

	stroke(117,94,94);
	strokeWeight(4.0);
	curve(p2.x, p2.y, p3.x, p3.y, p4.x, p4.y, p4.x, p4.y);
}

function mousePressed() {
    // when the user clicks, these variables are reassigned
    // to random values within specified ranges. For example,
    // 'faceWidth' gets a random value between 75 and 150.
    hair_length = random(200, 300);
    face_length = random(190, 210);
    hair_color = random(40,120);
    eye_pupil = random(17,22);
    cheek = random(15,17);

    //eyeSize = random(10, 30);
}

//{ } are braces
// [] are brackets.

/* lol you can do this for comment too */

Leave a Reply