//Kaicheng Li (KC) //991237116 void setup() { //window size size(400, 400); } void draw() { //background setting colorMode(RGB); noStroke(); //table rectMode(CORNERS); fill(220, 123, 72); rect(0, 0, 400, 400); fill(202, 104, 60); quad(20, 60, 80, 70, 120, 17, 220, 32); quad(90, 93, 237, 78, 323, 66, 382, 77); quad(150, 333, 120, 163, 223, 232, 280, 367); //book(diary) outlook fill(233); rect(60, 120, 320, 340); ellipseMode(CORNERS); ellipse(60, 110, 190, 130); ellipse(190, 110, 320, 130); fill(220, 123, 72); ellipse(60, 330, 190, 350); ellipse(190, 330, 320, 350); //book texture //leftside lines stroke(78, 161, 246, 150); strokeWeight(3); line(70, 170, 170, 170); line(70, 200, 170, 200); line(70, 230, 170, 230); line(70, 260, 170, 260); line(70, 290, 170, 290); //rightside lines line(210, 170, 300, 170); line(210, 200, 300, 200); line(210, 230, 300, 230); line(210, 260, 300, 260); line(210, 290, 300, 290); //words on book(happy) stroke(0); line(100, 150, 100, 170); line(120, 150, 120, 170); line(100, 160, 120, 160); ellipseMode(CENTER); noFill(); ellipse(110, 190, 17, 17); line(117, 187, 125, 200); ellipse(110, 215, 15, 15); line(100, 210, 100, 230); ellipse(110, 245, 15, 15); line(100, 240, 100, 260); line(100, 270, 105, 280); line(115, 270, 100, 290); //words on book(bad) line(240, 150, 240, 170); ellipse(247, 150, 14, 14); ellipse(247, 165, 14, 14); ellipse(250, 220, 17, 17); line(258, 220, 265, 228); ellipse(250, 280, 17, 17); line(260, 265, 260, 285); //sun light fill(250, 250, 0, 50); stroke(0, 0, 0, 20); ellipse(0, 0, (50+mouseX) * 0.5, (50+mouseX) * 0.5); ellipse(0, 0, (50+mouseX) * 0.4, (50+mouseX) * 0.4); ellipse(0, 0, (50+mouseX) * 0.3, (50+mouseX) * 0.3); ellipse(0, 0, (50+mouseX) * 0.2, (50+mouseX) * 0.2); //hide the half side of the book //leftside fill(233, 50+255-mouseX); noStroke(); rect(60, 120, 180, 320); fill(78, 161, 246, 150); rectMode(CORNERS); rect(70, 170, 170, 172); rect(70, 200, 170, 202); rect(70, 230, 170, 232); rect(70, 260, 170, 262); rect(70, 290, 170, 292); //rightside fill(233, -50+mouseX); rect(190, 120, 310, 320); fill(78, 161, 246, 150); rect(210, 170, 300, 172); rect(210, 200, 300, 202); rect(210, 230, 300, 232); rect(210, 260, 300, 262); rect(210, 290, 300, 292); //pencil fill(172, 121, 86); triangle(mouseX-10, mouseY-10, mouseX-20, mouseY+20, mouseX+10, mouseY+10); fill(0); triangle(mouseX-15, mouseY+10, mouseX-20, mouseY+20, mouseX-10, mouseY+15); fill(255, 151, 72); quad(mouseX-10, mouseY-10, mouseX+10, mouseY+10, mouseX+140, mouseY-90, mouseX+120, mouseY-120); //rain ellipseMode(CENTER); fill(78, 161, 246, -100+mouseY); noStroke(); frameRate(60); ellipse(frameCount % 150, -10+tan(frameCount * 0.05) * 20, 4, 5); ellipse(30+frameCount % 150, -12+tan(frameCount * 0.03) * 15, 4, 5); ellipse(59+frameCount % 150, -23+tan(frameCount * 0.06) * 17, 4, 5); ellipse(115+frameCount % 150, -16+tan(frameCount * 0.04) * 18, 4, 5); ellipse(230+frameCount % 150, -15+tan(frameCount * 0.06) * 19, 4, 5); ellipse(70+frameCount % 150, -20+tan(frameCount * 0.04) * 16, 4, 5); ellipse(90+frameCount % 150, -23+tan(frameCount * 0.02) * 13, 4, 5); ellipse(105+frameCount % 150, -30+tan(frameCount * 0.06) * 15, 4, 5); ellipse(120+frameCount % 150, -25+tan(frameCount * 0.07) * 17, 4, 5); ellipse(213+frameCount % 150, -17+tan(frameCount * 0.03) * 19, 4, 5); } void mousePressed(){ //when mouse pressed, no text on book frameRate(2); //book(diary) outlook fill(233); rect(60, 120, 320, 340); ellipseMode(CORNERS); ellipse(60, 110, 190, 130); ellipse(190, 110, 320, 130); fill(220, 123, 72); ellipse(60, 330, 190, 350); ellipse(190, 330, 320, 350); //book texture //leftside lines stroke(78, 161, 246, 150); strokeWeight(3); line(70, 170, 170, 170); line(70, 200, 170, 200); line(70, 230, 170, 230); line(70, 260, 170, 260); line(70, 290, 170, 290); //rightside lines line(210, 170, 300, 170); line(210, 200, 300, 200); line(210, 230, 300, 230); line(210, 260, 300, 260); line(210, 290, 300, 290); }