/////////////////////////////////////
/////////////SERENDIPITY:////////////
////The occurence and development////
////of events by chance in a happy///
//////////or beneficial way./////////
/////////////////////////////////////
//Based off the newly released song by Korean boy band BTS
/*Jimin's silhouette is visible, as he sits in the middle of
a room. He contemplatively regards the light swirling around
him as curtains billow behind him and a light swings from the
ceiling.*/
/*to give an impression that Jimin's world is shaking, "+sin(frameCount*0.X)" was added to the X-axis points in:
-the sofa and all shapes on the sofa
-the table
-Jimin's body EXCEPT FOR THE HEAD AND NECK
-the window
X represents the value between 8 and 10 that determines the offset of the vibration*/
void setup() {
size(400, 400);
background(11, 10, 16);
smooth();
rectMode(CORNERS);
noStroke();
noCursor();
}
void draw() {
//wall gradient
noStroke();
fill(75, 77, 82);
rect(0, 0+sin(frameCount*0.095), 400, 30+sin(frameCount*0.095));
fill(80, 82, 85);
rect(0, 30+sin(frameCount*0.095), 400, 60+sin(frameCount*0.095));
fill(83, 87, 96);
rect(0, 60+sin(frameCount*0.095), 400, 100+sin(frameCount*0.095));
fill(89, 95, 112);
rect(0, 100+sin(frameCount*0.095), 400, 170+sin(frameCount*0.095));
fill(93, 99, 116);
rect(0, 170+sin(frameCount*0.095), 400, 260+sin(frameCount*0.095));
fill(89, 95, 112);
rect(0, 260+sin(frameCount*0.095), 400, 300+sin(frameCount*0.095));
fill(80, 82, 85);
rect(0, 300+sin(frameCount*0.095), 100, 360+sin(frameCount*0.095));
//floor and shadow of sofa and Jimin
noStroke();
fill(200, 215, 244);
rect(40+sin(frameCount*0.09), 360, 400+sin(frameCount*0.09), 400);
fill(35, 39, 55);
rect(50+sin(frameCount*0.09), 340, 380+sin(frameCount*0.09), 380);
rect(0+sin(frameCount*0.09), 360, 80+sin(frameCount*0.09), 400);
triangle(40+sin(frameCount*0.09), 360, 50+sin(frameCount*0.09), 340, 50+sin(frameCount*0.09), 360);
triangle(80+sin(frameCount*0.09), 380, 80+sin(frameCount*0.09), 400, 90+sin(frameCount*0.09), 380);
//sofa on which Jimin sits
stroke(153, 175, 222);
fill(88, 110, 168);
rect(90+sin(frameCount*0.09), 260+sin(frameCount*0.09), 400+sin(frameCount*0.09), 320+sin(frameCount*0.09));
stroke(35, 58, 90);
fill(50, 66, 100);
rect(90+sin(frameCount*0.09), 320, 400+sin(frameCount*0.09), 340);
rect(90+sin(frameCount*0.09), 340, 400+sin(frameCount*0.09), 360);
rect(50+sin(frameCount*0.09), 290, 90+sin(frameCount*0.09), 360);
stroke(153, 175, 222);
line(50+sin(frameCount*0.09), 290, 90+sin(frameCount*0.09), 290);
line(90+sin(frameCount*0.09), 290, 90+sin(frameCount*0.09), 305);
//yellow cloth hanging on the arm chair
strokeWeight(2);
stroke(90, 88, 73);
fill(93, 91, 81);
triangle(50+sin(frameCount), 289, 89+sin(frameCount), 289, 90+sin(frameCount), 260);
rect(90+sin(frameCount), 260, 120+sin(frameCount), 320);
triangle(90+sin(frameCount), 260, 100+sin(frameCount), 250, 120+sin(frameCount), 260);
triangle(90+sin(frameCount), 260, 125+sin(frameCount), 245, 130+sin(frameCount), 260);
triangle(110+sin(frameCount), 260, 135+sin(frameCount), 250, 115+sin(frameCount), 320);
triangle(135+sin(frameCount), 250, 110+sin(frameCount), 320, 145+sin(frameCount), 320);
rect(130+sin(frameCount), 255, 143+sin(frameCount), 320);
rect(120+sin(frameCount), 320, 155+sin(frameCount), 360);
triangle(90+sin(frameCount), 320, 105+sin(frameCount), 335, 120+sin(frameCount), 320);
triangle(104+sin(frameCount), 334, 120+sin(frameCount), 320, 120+sin(frameCount), 345);
//cushion on sofa
noStroke();
fill(56, 73, 110);
quad(230+sin(frameCount*0.095), 260, 280+sin(frameCount*0.095), 270, 320+sin(frameCount*0.095), 250, 290+sin(frameCount*0.095), 320);
quad(230+sin(frameCount*0.095), 260, 240+sin(frameCount*0.095), 310, 220+sin(frameCount*0.095), 340, 300+sin(frameCount*0.095), 320);
quad(320+sin(frameCount*0.095), 250, 310+sin(frameCount*0.095), 300, 320+sin(frameCount*0.095), 340, 280+sin(frameCount*0.095), 320);
fill(41, 53, 84);
ellipse(280, 300, 10, 10);
strokeWeight(1);
stroke(41, 53, 84);
line(280, 300, 250, 280);
line(280, 300, 310, 270);
line(280, 300, 310, 330);
line(280, 300, 240, 320);
fill(42, 52, 80);
quad(320+sin(frameCount*0.095), 250+sin(frameCount*0.095), 310+sin(frameCount*0.095), 300+sin(frameCount*0.095), 320+sin(frameCount*0.095), 340+sin(frameCount*0.095), 300+sin(frameCount*0.095), 300+sin(frameCount*0.095));
//window frame
noStroke();
fill(139, 161, 214);
rect(110+sin(frameCount*0.8), 10+sin(frameCount*0.8), 290+sin(frameCount*0.8), 230+sin(frameCount*0.8));
fill(215, 230, 255);
rect(115+sin(frameCount*0.8), 15+sin(frameCount*0.8), 285+sin(frameCount*0.8), 225+sin(frameCount*0.8));
fill(139, 161, 214);
rect(125+sin(frameCount*0.8), 25+sin(frameCount*0.8), 275+sin(frameCount*0.8), 215+sin(frameCount*0.8));
fill(32, 53, 104);
rect(130+sin(frameCount*0.8), 30+sin(frameCount*0.8), 270+sin(frameCount*0.8), 210+sin(frameCount*0.8));
fill(58, 90, 161);
rect(160+sin(frameCount*0.8), 70+sin(frameCount*0.8), 240+sin(frameCount*0.8), 100+sin(frameCount*0.8));
fill(43, 69, 128);
rect(160+sin(frameCount*0.8), 100+sin(frameCount*0.8), 240+sin(frameCount*0.8), 140+sin(frameCount*0.8));
fill(69, 106, 183);
rect(160+sin(frameCount*0.8), 50+sin(frameCount*0.8), 240+sin(frameCount*0.8), 70+sin(frameCount*0.8));
fill(86, 126, 202);
rect(140+sin(frameCount*0.8), 40+sin(frameCount*0.8), 260+sin(frameCount*0.8), 50+sin(frameCount*0.8));
fill(91, 135, 210);
rect(130+sin(frameCount*0.8), 30+sin(frameCount*0.8), 270+sin(frameCount*0.8), 40+sin(frameCount*0.8));
//windows opening outward
noStroke();
fill(219, 226, 245);
triangle(130+sin(frameCount*0.8), 30+sin(frameCount*0.8), 130+sin(frameCount*0.8), 40+sin(frameCount*0.8), 160+sin(frameCount*0.8), 40+sin(frameCount*0.8));
rect(130+sin(frameCount*0.8), 40+sin(frameCount*0.8), 160+sin(frameCount*0.8), 205+sin(frameCount*0.8));
triangle(130+sin(frameCount*0.8), 210+sin(frameCount*0.8), 130+sin(frameCount*0.8), 205+sin(frameCount*0.8), 160+sin(frameCount*0.8), 205+sin(frameCount*0.8));
triangle(240+sin(frameCount*0.8), 40+sin(frameCount*0.8), 270+sin(frameCount*0.8), 30+sin(frameCount*0.8), 270+sin(frameCount*0.8), 40+sin(frameCount*0.8));
rect(240+sin(frameCount*0.8), 40+sin(frameCount*0.8), 270+sin(frameCount*0.8), 205+sin(frameCount*0.8));
triangle(240+sin(frameCount*0.8), 205+sin(frameCount*0.8), 270+sin(frameCount*0.8), 210+sin(frameCount*0.8), 270+sin(frameCount*0.8), 205+sin(frameCount*0.8));
fill(141, 176, 230);
quad(134+sin(frameCount*0.8), 38+sin(frameCount*0.8), 155+sin(frameCount*0.8), 43.5+sin(frameCount*0.8), 155+sin(frameCount*0.8), 200+sin(frameCount*0.8), 134+sin(frameCount*0.8), 205+sin(frameCount*0.8));
quad(266+sin(frameCount*0.8), 38+sin(frameCount*0.8), 245+sin(frameCount*0.8), 43.5+sin(frameCount*0.8), 245+sin(frameCount*0.8), 200+sin(frameCount*0.8), 266+sin(frameCount*0.8), 205+sin(frameCount*0.8));
fill(219, 226, 245);
rect(130+sin(frameCount*0.8), 110+sin(frameCount*0.8), 160+sin(frameCount*0.8), 116+sin(frameCount*0.8));
rect(240+sin(frameCount*0.8), 110+sin(frameCount*0.8), 270+sin(frameCount*0.8), 116+sin(frameCount*0.8));
//curtains
/*using really thick strokes, oscillate only the lowest point of each line at different
times in order to give the impression of curtains billowing in the wind */
/*Each curtain is comprised of 2 groups of 2 lines. The lines are spaced 10 pixels away from each other
the groups are spaced 20 pixels away from each other.*/
/*the bottom point of each line follows a sin function to determine its height.
the frameCount determines how out of sync each line is - by increasing and decreasing the */
//At the end of the curtain animation sequence, strokeWeight is set back to 1.
stroke(255, 255, 255, 140);
strokeWeight(20);
//left curtain
line(110, 10, 110, 210+20*sin(frameCount*0.02));
line(120, 10, 120, 210+20*sin(frameCount*0.025));
line(140, 10, 140, 210+20*sin(frameCount*0.03));
line(150, 10, 150, 210+20*sin(frameCount*0.01));
//right curtain
line(250, 10, 250, 210+20*sin(frameCount*0.02));
line(260, 10, 260, 210+20*sin(frameCount*0.025));
line(280, 10, 280, 210+20*sin(frameCount*0.03));
line(290, 10, 290, 210+20*sin(frameCount*0.02));
strokeWeight(1);
noStroke();
//Jimin's body
//neck
fill(89, 97, 136);
quad(190, 210, 210, 210, 215, 230, 185, 230);
//neck shadow
fill(80, 78, 100);
triangle(190, 210, 210, 210, 200+(mouseX-200)/10, 250+(mouseY-200)/30);
//shirt
fill(111, 129, 182);
triangle(160, 230, 185, 220, 200, 260);
triangle(200, 260, 215, 220, 240, 230);
stroke(255);
line(160, 230, 185, 220);
line(215, 220, 240, 230);
noStroke();
quad(160, 230, 180, 320, 220, 320, 240, 230);
fill(66, 82, 136);
triangle(150, 240, 160, 230, 170, 240);
triangle(230, 240, 240, 230, 250, 240);
quad(150, 240, 170, 230, 200, 320, 190, 320);
quad(250, 240, 230, 230, 200, 320, 210, 320);
//legs
fill(183, 195, 236);
ellipse(160, 300, 35, 30);
ellipse(225, 313, 40, 40);
quad(160, 290, 160, 320, 260, 320, 260, 300);
quad(210, 320, 240, 320, 220, 370, 200, 370);
//foot
fill(70, 65, 81);
rect(200, 370, 220, 380);
quad(200, 380, 220, 380, 230, 390, 210, 390);
quad(210, 390, 220, 400, 230, 397, 230, 390);
ellipse(205, 380, 12, 12);
//head
//The top part of the head moves in the opposite direction of the cursor to
//represent the back part of the head. After all, when your chin points to the left,
//your skull points to the right. The ears move with the "skull" opposite to the cursor,
//as does the "hair"
//left ear
fill(68, 68, 89);
stroke(113, 121, 146);
ellipse(215+(mouseX-200)/-100, 205+(mouseY-200)/-100, 10, 15);
//right ear
ellipse(185+(mouseX-200)/-100, 205+(mouseY-200)/-100, 10, 15);
//skull
noStroke();
fill(89, 97, 136);
ellipse(200+(mouseX-200)/-100, 195+(mouseY-200)/-100, 40, 40);
quad(185, 200, 190, 210, 210, 210, 215, 200);
//skull shadow
fill(80, 88, 127);
arc(200+(mouseX-200)/-100, 195+(mouseY-200)/-100, 40, 40, 0, PI);
fill(89, 97, 136);
quad(180+(mouseX-200)/-100, 190+(mouseY-200)/-100, 220+(mouseX-200)/-100, 190+(mouseY-200)/-100, 210+(mouseX-200)/-100, 205+(mouseY-200)/-100, 190+(mouseX-200)/-100, 205+(mouseY-200)/100);
//chin
fill(80, 88, 127);
ellipse(200+(mouseX-200)/30, 205+(mouseY-200)/50, 30, 25);
fill(89, 97, 136);
ellipse(200+(mouseX-200)/30, 200+(mouseY-200)/50, 28, 21);
//table
//tabletop
fill(245, 250, 255);
quad(110+sin(frameCount*0.9), 320, 150+sin(frameCount*0.9), 300, 360+sin(frameCount*0.9), 300, 360+sin(frameCount*0.9), 320);
//side
fill(67, 60, 62);
quad(150+sin(frameCount*0.9), 320, 160+sin(frameCount*0.9), 320, 150+sin(frameCount*0.9), 390, 140+sin(frameCount*0.9), 390);
//back leg
fill(78, 79, 92);
rect(110+sin(frameCount*0.9), 320, 360+sin(frameCount*0.9), 330);
//ledge side
fill(68, 65, 66);
rect(140+sin(frameCount*0.9), 350, 360+sin(frameCount*0.9), 355);
//front leg
fill(80, 77, 80);
quad(140+sin(frameCount*0.9), 330, 150+sin(frameCount*0.9), 330, 130+sin(frameCount*0.9), 395, 120+sin(frameCount*0.9), 395);
//ledge
fill(39, 36, 49);
quad(145+sin(frameCount*0.9), 350, 158+sin(frameCount*0.9), 340, 360+sin(frameCount*0.9), 340, 360+sin(frameCount*0.9), 350);
//cursor aka floating light
fill(255, 255, 255);
ellipse(mouseX, mouseY, 20, 20);
fill(255, 204, 0, 40);
ellipse(mouseX, mouseY, 40, 40);
fill(255, 204, 0, 30);
ellipse(mouseX, mouseY, 80, 80);
fill(255, 204, 0, 15);
ellipse(mouseX, mouseY, 160, 160);
//swinging lamp
stroke(0);
strokeWeight(2.5);
line(320, 0, 320+50*sin(frameCount*0.02), 110+abs(40*cos(frameCount*0.02)));
noStroke();
fill(208, 226, 246, 175);
ellipse(320+50*sin(frameCount*0.02), 110+abs(40*cos(frameCount*0.02)), 20, 20);
fill(255, 255, 255, 175);
ellipse(320+50*sin(frameCount*0.02), 115+abs(40*cos(frameCount*0.02)), 30, 30);
//doors framing the scene
noStroke();
fill(64, 76, 106);
rect(30, 0, 40, 400);
rect(360, 0, 370, 400);
fill(11, 10, 16);
rect(0, 0, 30, 400);
rect(370, 0, 400, 400);
}
void mousePressed() {
println("You're my calico cat");
}
void keyPressed() {
println("Preorder Love Yourself pt. 1 'Her' by BTS");
}