# Simplified Selfies

For the selfie assignment, I didn’t draw pictures that are similar to my face. Rather, I have drawn some simplified facial expressions that best describe my mood in a day. For each facial expression, I used some basic functions we learned in class. Here are some samples of the simplified selfies.

My program is cyclic, meaning that it repeats the expressions every minute. I used the function second() to sync my program with the clock of my computer. The first 30 seconds are set at night while the rest of the minute is set to daytime. The frame is always divided into two parts: the upper half representing the sky and the lower half containing the facial expressions. My code is attached below.

```//variable for x & y pos of sun
float xPos;
float yPos;
//speed of sun on each axis
float xSpeed = 0.5;
float ySpeed = 0.5;

int i = 0;

void setup() {
size(700, 700);
}

void draw() {
int s = second();  // Values from 0 - 59
println("s:", s);

//NIGHT
if (s < 30) {
//draw night background
noStroke();
fill(0);
rect(0, 0, width, height);

//draw moon
fill(#F3F711);
arc(600, 70, 50, 50, -1.05, 2.09);

//draw stars
for (int i = 0; i < 50; i += 1) {
fill(#F3F711);
ellipse(random(50, 650), random(30, 400), 4, 4);
delay(20);
}

if (s < 10) {
//sleeping face
if (s % 2 == 0) {
println("Even");
//sleep 1
stroke(255);
strokeWeight(6);
line(150, 500, 250, 500);
line(300, 500, 400, 500);
fill(255);
ellipse(275, 550, 10, 10);
line(450, 530, 470, 530);
line(470, 530, 450, 550);
line(450, 550, 470, 550);
line(520, 500, 560, 500);
line(560, 500, 520, 540);
line(520, 540, 560, 540);
}

if (s % 2 != 0) {
println("Odd");
//sleep 2
stroke(255);
strokeWeight(6);
line(150, 500, 250, 500);
line(300, 500, 400, 500);
noFill();
ellipse(275, 550, 40, 40);
}
}

if (s>=10 && s<15) {
//shock face
noFill();
stroke(255);
strokeWeight(6);
ellipse(200, 480, 50, 50);
ellipse(320, 480, 50, 50);
ellipse(260, 560, 70, 70);
//clock
strokeWeight(4);
ellipse(550, 480, 120, 120);
line(550, 480, 520, 525);
}

if (s>=15 && s<22) {
//angry face
noFill();
stroke(255);
strokeWeight(3);
line(130, 500, 130, 530);// zuo shang
line(115, 530, 130, 530);
line(140, 500, 140, 530);// you shang
line(140, 530, 155, 530);
line(115, 540, 130, 540);// zuo xia
line(130, 540, 130, 570);
line(140, 540, 140, 570);// you xia
line(140, 540, 155, 540);
strokeWeight(7);
line(170, 505, 250, 505);//left eye
line(300, 505, 380, 505);//right eye
strokeWeight(3);
line(255, 525, 295, 525);//mouth
line(255, 525, 255, 555);
line(295, 525, 295, 555);
line(268, 525, 268, 555);
line(282, 525, 282, 555);
line(250, 555, 300, 555);
//clock
strokeWeight(4);
ellipse(550, 480, 120, 120);
line(550, 480, 520, 525);
}

if (s>= 22 && s<30) {
//crying face
noFill();
stroke(255);
strokeWeight(6);
line(150, 500, 250, 500);//left eye
line(175, 500, 175, 540);
line(225, 500, 225, 540);
line(320, 500, 420, 500);//right eye
line(345, 500, 345, 540);
line(395, 500, 395, 540);
line(230, 560, 340, 560);
//clock
strokeWeight(4);
ellipse(550, 480, 120, 120);
line(550, 480, 520, 525);
}
}

//DAYTIME
if (s >= 30) {
//draw day background
noStroke();
fill(255);
rect(0, 0, width, height);

//draw sky
fill(135, 206, 250);
rect(0, 0, width, height/2);

//draw moving sun
xPos = i;
if (xPos < width/2) {
yPos = width/2 - xPos;
}
if (xPos>=width/2) {
yPos = xPos - width/2;
}
float diam = 40;
fill(255, 0, 0);
ellipse(xPos, yPos, diam, diam);
delay(35);
println("Sun");
xPos += xSpeed;
yPos += ySpeed;
i += 1;
if (i>700) {
i=0;
}

//draw dots
for (int i = 0; i < 50; i += 1) {
fill(255);
ellipse(random(50, 680), random(30, 340), 4, 4);
}

if (s >=30 && s < 40) {
//stretch face 1
stroke(0);
strokeWeight(6);
noFill();
ellipse(200, 500, 60, 60);//left eye
fill(0);
ellipse(200, 500, 10, 10);
noFill();
ellipse(400, 500, 60, 60);//right eye
fill(0);
ellipse(400, 500, 10, 10);
line(266, 530, 334, 530);//mouth
line(150, 550, 120, 510);//left hand
line(450, 550, 480, 510);//right hand
//clock
noFill();
strokeWeight(4);
ellipse(550, 480, 120, 120);
line(550, 480, 495, 480);
}

if (s>=40 && s<50) {
//studying face
stroke(0);
strokeWeight(6);
noFill();
ellipse(200, 500, 50, 50);//left eye
line(190, 500, 210, 500);
ellipse(400, 500, 50, 50);//right eye
line(390, 500, 410, 500);
line(260, 490, 340, 490);//nose
line(260, 490, 260, 525);
line(340, 490, 340, 525);
line(283, 490, 283, 525);
line(317, 490, 317, 525);
line(240, 525, 360, 525);
line(180, 540, 270, 560);//left hand
line(420, 540, 330, 560);//right hand
//clock
noFill();
strokeWeight(4);
ellipse(550, 480, 120, 120);
line(550, 480, 520, 435);
}

if (s>=50 && s<59) {
//stretch face 2
strokeWeight(6);
stroke(0);
line(150, 500, 240, 500);//left eye
line(330, 500, 420, 500);//right eye
line(245, 510, 325, 510);//nose
line(245, 510, 285, 570);
line(325, 510, 285, 570);
line(140, 550, 110, 520);//left hand
line(440, 550, 470, 520);//right hand
//clock
noFill();
strokeWeight(4);
ellipse(550, 480, 120, 120);
line(550, 480, 580, 435);
}

if (s == 59) {
background(0);
}
}
}```