// Window by Sean Kovacko // Interactive drawing where the sky outside the window changes from day to night // // Instructions: Move the mouse up and down through the y-axis to change the scene from day to night // and turn on the lamp on the nearby table. Moving the mouse also moves the sun and moon. void setup() { size(400, 400); frameRate(60); smooth(); } void draw() { // Background background(255); // Sky fill(148, 224, 237); rect(50, 50, 180, 270); // Night Sky noStroke(); fill(9, 58, 98, mouseY); rect(50, 50, 180, 270); // Stars fill(234, 234, 234, mouseY-250); rect(90, 90, 5, 5); rect(100, 130, 5, 5); rect(175, 200, 4, 4); rect(125, 180, 5 ,5); rect(130, 80, 3, 3); rect(180, 100, 5, 5); rect(115, 140, 4, 4); rect(150, 160, 5, 5); rect(160, 70, 5, 5); rect(120, 60, 5, 5); rect(95, 215, 3, 3); rect(190, 185, 5, 5); // Sun noStroke(); fill(254, 255, 49); ellipse(mouseX, mouseY+80, 50, 50); // Moon noStroke(); fill(255); ellipse(mouseX, mouseY-250, 50, 50); // Moon Shadow fill(9, 58, 98); ellipse(mouseX-10, mouseY-260, 40, 40); // Wall fill(94, 177, 191); rect(0, 0, 50, 400); fill(94, 177, 191); rect(50, 0, 350, 50); fill(94, 177, 191); rect(50, 320, 350, 80); fill(94, 177, 191); rect(230, 50, 170, 270); // Window Ledge noStroke(); fill(124, 63, 16); rect(45, 45, 190, 10); noStroke(); fill(124, 63, 16); rect(45, 320, 190, 10); // Table leg 1 noStroke(); fill(124, 63, 16); rect(260, 260, 10, 140); // Table leg 2 noStroke(); fill(124, 63, 16); rect(370, 260, 10, 140); // Table top noStroke(); fill(124, 63, 16); rect(260, 260, 120, 20); // Curtain Rod stroke(0, 0 ,0); strokeWeight(4); line(30, 40, 250, 40); // Rod End 1 noStroke(); fill(0, 0, 0); ellipse(30, 40, 10, 20); //Rod End 2 noStroke(); fill(0, 0, 0); ellipse(250, 40, 10, 20); // Curtain 1 noStroke(); fill(195, 245, 224); rect(40, 40, 40, 340); // Curtain 2 noStroke(); fill(195, 245, 224); rect(200, 40, 40, 340); // Lamp Light Up fill(242, 237, 81, mouseY-300); triangle(230, 0, 310, 180, 395, 0); // Lamp base fill(155, 54, 14); rect(280, 240, 60, 20, 8, 8, 0, 0); // Lamp neck triangle(310, 250, 295, 200, 325, 200); // Lamp Light Down fill(242, 237, 81, mouseY-300); triangle(230, 400, 310, 180, 395, 400); // Lamp shade fill(255); rect(280, 160, 60, 45); // Wall Outlet rect(350, 365, 8, 16); //Lamp Cord stroke(0, 0, 0); strokeWeight(1); line(354, 280, 354, 370); // Lamp Shade Light On fill(247, 245, 182, mouseY-300); rect(280, 160, 60, 45); }