I was inspired by the de Stijl art style prior to coding this self portrait, so I incorporated the abstract, geometrical style into my work. I used various rectangles and ellipses to represent my facial features (such as my glasses and mole), and I also used arcs for my face shape and hair shape. It was hard for me to “paint” certain areas in one go, so I had to divide them into small pieces of geometries.
/*
Xu Xu
Section B
xux1@andrew.cmu.edu
Project-01
*/
function setup() {
createCanvas(600, 750);
background(220);
text("p5.js vers 0.9.0 test.", 10, 15);
}
function draw() {
//faceshape
fill(239,239,239)
noStroke();
rect(0,0,300,800);
fill("black")
noStroke();
rect(300,0,300,800);
//hair
fill(50,0,1)
arc(300,250,420,420,600,0);
fill(50,0,1)
noStroke();
rect(90,250,220,150);
fill(50,0,1)
rect(90,500,220,300);
fill(350,81,58)
noStroke();
rect(300,250,210,400);
fill(350,81,58)
rect(300,700,210,100);
//neck
fill(95,26,55)
rect(300,250,80,550);
fill(89,248,232)
rect(220,250,80,550);
//face
fill(231,29,54)
ellipse(300,250,350,350);
fill(55,63,81)
noStroke();
arc(300,250,350,350,0,PI + QUARTER_PI + QUARTER_PI);
fill(89,248,232)
arc(300,250,350,650,0,PI);
fill(210,207,218)
arc(300,280,350,630,0,PI);
fill("grey")
rect(320,280,155,10);
fill("white")
rect(100,250,200,5);
fill(252,220,77)
rect(110,255,190,200);
//eyes
fill("white")
arc(400,280,150,20,0,PI);
fill("black")
ellipse(430,300,7,7);
fill("black")
rect(410,280,10,10);
//mouth
fill("red")
rect(260,510,80,10);
fill(2199,129,175)
arc(300,525,80,25,0,PI);
fill("black")
rect(130,270,150,10);
//glasses
noFill();
stroke(111,45,189)
strokeWeight(10);
rect(90,230,200,100);
fill(111,45,189)
rect(70,250,20,30);
}