/* Late Night Reading Creator: Aaron Munavish-Hogarth 991 508 592 Intro to Media Computation Sept 18, 2018 Instructor: Nicolas Hesler Move the mouse up and down (Y - axis) to interact with the lighting, move the mouse side to side (X - Axis) to interact with Jessica's eyes, click the mouse button to swtich books and to make Jessica yawn (Text in console). */ void setup() { size(400,400); // Size of screen noStroke(); } void draw() { background(255); // The background will be drawn in white. ellipseMode(CENTER); // Turning ellipse intp center mode. rectMode(CORNER); // Turning rectangle into corner mode frameRate(60); //Making sure the frame rate stays at 60 after certain events such as key pressed. // Background wooden wall fill(80, 50, 0); // First layer of panel, fills up entire wall with one colour. rect(0, 0, 400, 300); // Second layer of panel, fill the cracks inbetween. fill(50, 30, 0); rect(0, 0, 5, 300); fill(50, 30, 0); rect(25, 0, 5, 300); fill(50, 30, 0); rect(50, 0, 5, 300); fill(50, 30, 0); rect(75, 0, 5, 300); fill(50, 30, 0); rect(100, 0, 5, 300); fill(50, 30, 0); rect(125, 0, 5, 300); fill(50, 30, 0); rect(150, 0, 5, 300); fill(50, 30, 0); rect(175, 0, 5, 300); fill(50, 30, 0); rect(200, 0, 5, 300); fill(50, 30, 0); rect(225, 0, 5, 300); fill(50, 30, 0); rect(250, 0, 5, 300); fill(50, 30, 0); rect(275, 0, 5, 300); fill(50, 30, 0); rect(300, 0, 5, 300); fill(50, 30, 0); rect(325, 0, 5, 300); fill(50, 30, 0); rect(350, 0, 5, 300); fill(50, 30, 0); rect(375, 0, 5, 300); fill(50, 30, 0); rect(400, 0, 5, 300); // Floor layer one. fill(50, 30, 0); rect(0, 300, 400, 100); // End of wall fill(65, 40, 0); rect(0, 290, 400, 20); //Floor layer two fill(40, 20, 0); rect(0, 300, 400, 50); // Colour of the sky in the background, this is the first layer that will be layered over by another colour that will phase out depending on where the mouse is. fill(0, 0, 50); rect(40, 40, 140, 140); fill(0, 0, 100, mouseY/400.0*200); rect(40, 40, 140, 140); // Moon in the sky with details stroke(255); fill(255); ellipse(60, mouseY*0.4, 20, 20); // The moon plus making the moon move up and down on the Y axis at a slow rate fill(0, 0, 150, 50); ellipse(60, mouseY*0.4, 20, 20); stroke(0); fill(220); ellipse(60, mouseY*0.4, 2, 2); // Shadowing on the ceiling. fill(40, 20, 0); rect(0, 0, 400, 10); //Trees out the window (left). noStroke(); fill(0, 120, 0); ellipse(50, 130, 20, 20); fill(0, 90, 0); ellipse(60, 140, 30, 30); fill(0, 40, 0); ellipse(50, 150, 40, 40); fill(0, 60, 0); ellipse (40, 140, 20, 20); fill(0, 50, 0); ellipse(70, 160, 20, 20); // Window frame. fill(40, 20, 0); rect(30, 30, 10, 150); fill(40, 20, 0); rect(30, 30, 150, 10); fill(40, 20, 0); rect(170, 30, 10, 150); fill(40, 20, 0); rect(30, 170, 150, 10); // Cross in the middle of window. fill(40, 20, 0); rect(100, 40, 10, 130); fill(40, 20, 0); rect(40, 100, 130, 10); // White streaks on Window (Light reflection). stroke(mouseY/400.0*255); line(130, 90, 160, 60); stroke(mouseY/400.0*255); line(120, 80, 150, 50); strokeWeight(1); noStroke(); //Getting rid of stroke once again. // Rectangle reflection on window. fill(255, 255, 255, mouseY/400.0*50); rect(115, 45, 50, 50); fill(255, 255, 255, mouseY/400.0*50); rect(115, 115, 50, 50); fill(255, 255, 255, mouseY/400.0*50); rect(45, 45, 50, 50); fill(255, 255, 255, mouseY/400.0*50); rect(45, 115, 50, 50); //Window sill. fill(50, 30, 0); rect(20, 180, 170, 20); fill(20, 10, 0); rect(30, 190, 150, 10); //Background of book Shelf to the right. fill(20, 10, 0); rect(200, 75, 200, 250); //Ledges of the bookshelf fill(50, 30, 0); rect(200, 75, 200, 10); fill(50, 30, 0); rect(200, 150, 200, 10); fill(50, 30, 0); rect(200, 75, 10, 275); fill(50, 30, 0); rect(200, 225, 200, 10); //Books that are laying on shelf. fill(140, 0, 0); rect(210, 100, 10, 50); fill(0, 140, 0); rect(220,100, 10, 50); fill(0, 0, 190); rect(230, 100, 10, 50); // The tables Legs. fill(70, 50, 0); rect(30, 300, 10, 90); fill(70, 50, 0); rect(80, 300, 10, 90); fill(80, 60, 0); rect(5, 300, 20, 100); fill(80, 60, 0); rect(95, 300, 20, 100); // Base of the table that will hold a candle. fill(80, 60, 0); ellipse(60, 300, 120, 50); //Glow under Candle fill(100, 80, 0); ellipse(60, 295, 80, mouseY*0.1); //The candle ontop of the Table fill(150, 0, 0); rect(50, 225, 10, 60); //Plate that holds the candle fill(180, 200, 0); ellipse(55, 290, 30, 10); //Candle glow. fill(255, 255, 255, 100); ellipse(55, 215, mouseY*0.1, 40); fill(200, 240, 0, 100); ellipse(55, 215, mouseY*0.1, 5); noStroke(); // The chair fill(80, 0, 0); rect(250, 270, 100, 100); fill(100, 0, 0); rect(250, 180, 100, 100); // Jessica's dress/skirt fill(100, 0, 100); quad(200, 400, 300, 400, 300, 300, 210, 300); fill(80, 0, 80); quad(300, 300, 210, 300, 250, 270, 350, 270); fill(90, 0, 90); quad(250, 270, 350, 270, 325, 225, 275, 225); fill(90, 0, 90); quad(325, 225, 275, 225, 250, 150, 350, 150); fill(120, 0, 120); triangle(200, 400, 175, 400, 210, 300); fill(120, 0, 120); triangle(300, 400, 350, 400, 300, 300); // Jessica's right arm (Her left) fill(20, 80, 0); rect(335, 160, 10, 80); fill(30, 100, 0); quad(335, 240, 345, 240, 290, 280, 290, 260); //Jessica's left arm (Her right) fill(30, 100, 0); quad(255, 160, 265, 195, 265, 240, 255, 220); //Jessica's Book fill(140, 100, 0); quad(280, 280, 250, 260, 250, 210, 280, 240); fill(149, 100, 0); quad(280, 240, 280, 280, 320, 275, 320, 220); fill(160, 120, 0); rect(275, 240, 10, 40); //Jessica's neck fill(20, 80, 0); quad(285, 155, 315, 155, 315, 105, 305, 105); fill(228, 232, 183); quad(290, 160, 310, 155, 310, 105, 310, 110); fill(228, 232, 183); triangle(285, 155, 315, 155, 295, 170); //Jessica's Head fill(30, 100, 0); ellipse(300, 100, 50, 50); //Jessica's tongue fill(155, 0, 0); rect(295, 120, 5, 20); //Jessica's eyes fill(0); ellipse(310, 110, 5, mouseX*0.05); fill(0); ellipse(285, 110, 5, mouseX*0.05); //Jessica's left hand (her right). fill(30, 100, 0); quad(250, 240, 250, 250, 265, 255, 265, 245); //The top layer of everything, a rectangle that brightens as the mouse moves simulating light. fill(255, 255, 255, mouseY/400.0*15); rect(0, 0, 400, 400); } //Transformation line! When the mouse is clicked the books in the background and book being held will change colour. void mousePressed() { //Reducing the frame rate frameRate(0.5); //Books will swtich spots fill(140, 100, 0); rect(210, 100, 10, 50); fill(0, 0, 190); rect(220,100, 10, 50); fill(0, 140, 0); rect(230, 100, 10, 50); fill(140, 0, 0); quad(280, 280, 250, 260, 250, 210, 280, 240); fill(140, 0, 0); quad(280, 240, 280, 280, 320, 275, 320, 220); fill(180, 0, 0); rect(275, 240, 10, 40); //Jessica's left hand (her right). fill(30, 100, 0); quad(250, 240, 250, 250, 265, 255, 265, 245); //Pressing the mouse button makes this text appear in the console. println ("*Yawn*"); }