function setup() {
createCanvas(600, 636);
background(220);
text("p5.js vers 0.5.12 test.", 10, 15);
}
function draw() {
//background
background(175, 200, 135);
//hair
noStroke();
fill(0);
ellipse(297, 225, 374, 374);
//face
noStroke();
fill(117, 77, 37);
rect(150, 177, 290, 266);
quad(150, 442, 440, 442, 354, 595, 240, 595);
//nose
noStroke();
fill(110, 70, 40);
quad(280, 450, 320, 450, 335, 470, 264, 470);
fill(121, 79, 37);
triangle(280, 450, 300, 330, 320, 450);
//ears
noStroke();
fill(117, 77, 37);
arc(140, 349, 55, 90, HALF_PI, HALF_PI);
arc(450, 349, 55, 90, HALF_PI, HALF_PI);
//inner ears
fill(110, 70, 40)
//glasses
noFill();
stroke(77, 77, 77);
strokeWeight(15);
rect(129, 301, 152, 91);
rect(309, 301, 152, 91);
line(281, 320, 309, 320);
//eyes
noStroke();
fill(256);
ellipse(219, 349, 75, 44);
ellipse(372, 349, 75, 44);
fill(0);
ellipse(230, 355, 32, 32);
ellipse(384, 355, 32, 32);
//eyebrows
noFill();
stroke(0);
strokeWeight(12);
arc(230, 220, 195, 120, HALF_PI, PI-0.8);
arc(384, 220, 195, 120, HALF_PI, PI-0.8);
//mouth
noStroke();
fill(27);
quad(235, 510, 365, 510, 325, 560, 275, 560);
fill(290, 30, 121);
arc(300, 560, 48, 34, PI, PI);
}
The assignment wasn’t too difficult. I first abstracted a picture of myself into shapes in Illustrator, and used this as the foundation for constructing my code.