Project 1: Self Portrait

I wasn’t sure how to embed the sketch.js file so here’s the code itself:

function setup() {
createCanvas(400, 400);
background(220);
text(“p5.js vers 0.9.0 test.”, 10, 15);
}

function draw() {
background(240);
strokeWeight(3);
line(70,70,30,220);
line(30,220,140,210);
line(140,210,146,270);
line(146,270,175,267);
curve(175,267,190,150,180,140);
line(175,267,180,300);
//contour of nose and mouth
strokeWeight(2);
ellipse(70,70,80);
fill(0);
circle(80,80,25);
//right eyeball and pupil
fill(255)
ellipse(200,140,80);
fill(0);
circle(210,150,25);
//left eyeball and pupil
ellipse(90,200,50,10);
//nostril
noStroke();
fill(60,200,30);
rect(90,200,20,100);
circle(100,300,20);
fill(255);
circle(105,290,5);
//booger
arc(100,100,30,0,180);
//smile
fill(0);
rect(180,70,70,15);
rect(30,20,70,15);
//eyebrows
noLoop()

}

Leave a Reply