Project-1-Face-sjahania

sketch

function setup() {
    createCanvas(200, 200);
    background(0,83,124);
}
function setGradient(x, y, w, h, c1, c2) {

  noFill();

  // Top to bottom gradient
for (var i = y; i <= y+h; i++) {
  var inter = map(i, y, y+h, 0, 1);
  var c = lerpColor(c1, c2, inter);
  stroke(c);
  line(x, i, x+w, i);
 }
}

function draw() {
	//bow
	fill(255,95,60);
	stroke(0);
	strokeWeight(0.5);
	triangle(80,85,85,55,110,75);
	triangle(120,85,115,55,90,75);
	ellipse(100,65,8,10);

	//hair
	noStroke();
	fill(55,22,0);
	rect(75,90,50,80);

	//highlights
	c2 = color(255,206,69);
	c1 = color(55,22,0);
	setGradient(75,120,50,30,c1,c2)

	//neck
	fill(255,213,161);
	rect(88,120,24,20);
	arc(100,140,24,29,0,PI);

	//jawline
	noFill();
	strokeWeight(.5);
	stroke(0);
	arc(100,103,40,60,0,PI);

	//face
	noStroke();
	fill(255,213,161);
	ellipse(100,100,50,60);

	//bangs
	fill(55,22,0);
	arc(90,90,45,50,PI-QUARTER_PI,TWO_PI-QUARTER_PI);
	arc(110,90,45,50,PI+QUARTER_PI,QUARTER_PI);
	fill(255,213,161);
	arc(100,100,45,50,QUARTER_PI,TWO_PI-QUARTER_PI);
	arc(100,100,45,50,PI+QUARTER_PI,PI-QUARTER_PI)


	//whites of eyes
	fill(255);
	ellipse(90,100,10,7);
	ellipse(110,100,10,7);

	//eye color
	fill(55,22,0);
	ellipse(90,100,7,7);
	ellipse(110,100,7,7);

	//eyebrows
	noFill();
	stroke(55,22,0);
	strokeWeight(1.75);
	arc(89,94,15,4,PI,TWO_PI-QUARTER_PI);
	arc(111,94,15,4,PI+QUARTER_PI,TWO_PI);

	//nose
	noFill();
	stroke(55,22,0);
	strokeWeight(1);
	arc(100,110,8,8,PI,TWO_PI);

	//mouth
	noStroke();
	fill(0);
	arc(100,118,12,9,0,PI);

	//tongue
	fill(255,133,159);
	arc(100,120,8,5,0,PI);

	//shirt
	fill(255,95,60);
	noStroke();
	rect(60,145,80,60,25,25,0,0);

	//shirt collar
	stroke(0);
	strokeWeight(.5);
	arc(93,152,20,20,QUARTER_PI,PI+QUARTER_PI);
	arc(107,152,20,20,TWO_PI-QUARTER_PI,PI-QUARTER_PI);

	//arm holes
	fill(0,83,124);
	triangle(75,200,75,170,78,200);
	triangle(122,200,125,170,125,200);
	noStroke();
	fill(255,213,161);
	triangle(88,145,100,159,112,145);



}

I had a lot of trouble at first, especially since I have no eye for aesthetic, but eventually I got the hang of figuring out where things should go. I also added something from the p5.js website that allowed me to put a gradient in my hair.

Leave a Reply