// Nawon Choi
// Section C
// Project-01 Self-Portrait
function setup() {
createCanvas(500, 500);
background(220);
}
function draw() {
// background
noStroke();
fill("#E3CBC8");
rect(0, 0, 500, 250);
// head
noStroke();
fill("#6A6159");
ellipse(234, 250, 395, 500);
noStroke();
fill("#6A6159");
ellipse(312, 249, 302, 465);
noStroke();
fill("#F2E3C2");
ellipse(255, 236, 356, 423);
noStroke();
fill("#6A6159");
rect(122, 142, 69, 16);
noStroke();
fill("#6A6159");
rect(315, 142, 69, 16);
noStroke();
fill("#6A6159");
quad(128, 61, 303, 30, 200, 125, 54, 182);
noStroke();
fill("#6A6159");
triangle(224, 16, 303, 30, 153, 57);
// table
noStroke();
fill("#AA827C");
rect(0, 250, 500, 134);
noStroke();
fill("#9B736D");
rect(0, 384, 500, 30);
noStroke();
fill("#E1ACA4");
rect(0, 414, 500, 86);
// rice
noStroke();
fill("#F3EEE9");
rect(163, 250, 175, 80, 29);
// egg
noStroke();
fill("#F2BD39");
rect(143, 224, 214, 53, 7);
noStroke();
fill("#F8D683");
rect(143, 224, 214, 20, 7);
// seaweed
noStroke();
fill("#424944");
rect(235, 220, 30, 24);
noStroke();
fill("#27312B");
rect(235, 244, 30, 33);
noStroke();
fill("#151916");
rect(235, 277, 30, 53);
// eyes
noStroke();
fill("#ffffff");
ellipse(154, 198, 57, 46);
noStroke();
fill("#ffffff");
ellipse(347, 198, 57, 46);
// eyeballs
let x1, x2, y;
// let x1 = mouseX+153;
// x2 = mouseX
// y = mouseY-142;
// LEFT x range: (142 - 166)
// RIGHT x range: (335 - 359)
// y range: (192 - 205)
if (mouseY < 192 ){
y = 192;
} else if (mouseY >= 192 & mouseY <=205) {
y = mouseY;
} else {
y = 205;
}
if (mouseX < 142) {
x1 = 142,
x2 = 335;
} else if (mouseX >= 142 & mouseX <= 166) {
x1 = mouseX,
x2 = 335;
} else if (mouseX > 166 & mouseX < 335) {
x1 = 166,
x2 = 335;
} else if (mouseX >= 335 & mouseX <= 359) {
x1 = 166,
x2 = mouseX;
} else {
x1 = 166,
x2 = 359;
}
noStroke();
fill("#6A6159");
ellipse(x1, y, 33, 33);
noStroke();
fill("#6A6159");
ellipse(x2, y, 33, 33);
noStroke();
fill("#FAFAFA");
ellipse(x1-4, y-4, 12, 12);
noStroke();
fill("#FAFAFA");
ellipse(x2-4, y-4, 12, 12);
}
I definitely wanted to have an interactive component for my self-portrait, so I made the eyes follow the direction of the mouse. Perhaps the most challenging part of this project was coding the values so that the eyeballs would stay within the range of the eyes. I thought for a while on what I wanted my self-portrait to look like, and ultimately, I decided to focus on my two of my favorite foods—eggs and sushi.