Your browser does not support the canvas tag.

previous        Show / Hide Source        Download        next
/*
  Living + Dead Cities
  Evan McQueen, 2018-09-18

  Simple image of a modern day city. Moving mouse to the left will reveal
  an alternate destroyed version, with a significantly different atmosphere.
*/

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

void draw(){
  background(92, 171, 227);
  //background(61, 60, 70); RGB for night time version
  
  //Sunset Gradient (Purple glow behind city, thought it looked neat)
  fill(153, 133, 204);
  rect(0, 330, 400, 30);
  fill(153, 133, 204, 200);
  rect(0, 310, 400, 20);
  fill(153, 133, 204, 150);
  rect(0, 290, 400, 20);
  fill(153, 133, 204, 100);
  rect(0, 270, 400, 20);
  fill(153, 133, 204, 50);
  rect(0, 250, 400, 20);
  fill(153, 133, 204, 25);
  rect(0, 230, 400, 20);
  
  noStroke();
  
  // NON DESTROYED VERSION \\
  
  
  //Buildings so far in the background they need another section
  fill(25, 43, 62);
  rect(280, 280, 20, 80);
  fill(52, 73, 90);
  triangle(280, 280, 300, 280, 290, 270);
  
  //Monorail Track
  fill(20, 28, 46, mouseX);
  rect(0, 275, 500, 3);
  
  //Train
  fill(5, 16, 30, mouseX);
  rect((140-(tan(frameCount * 0.003) * 200)), 272, 40, 3);
  
  //Background Buildings (i.e misc, tend to be smaller + closer to ground)
  fill(20, 28, 46);
  rect(80, 280, 20, 80);
  
  fill(10, 47, 69);
  rect(95, 250, 30, 110);
  fill(5, 104, 139);
  rect(95, 250, 30, 15);
  
  fill(67, 107, 120);
  rect(170, 320, 50, 40);
  
  fill(47, 51, 84);
  rect(15, 300, 10, 60);
  
  fill(20, 28, 46);
  rect(240, 310, 15, 50);
  
  //A (Biggest one, has an antenna)
  fill(155, 196, 221, mouseX);
  triangle(130, 140, 150, 140, 140, 320);
  fill(3, 92, 155, mouseX);
  triangle(130, 140, 120, 260, 140, 280);
  fill(10, 114, 168, mouseX);
  triangle(150, 140, 160, 263, 140, 280);
  fill(0, 27, 66, mouseX);
  rect(130, 135, 20, 5);
  rect(133, 132, 14, 5);
  triangle(138, 132, 142, 132, 140, 60);
  fill(3, 80, 114, mouseX);
  ellipse(138, 265, 35, 35);
  //line(130, 120, 150, 120);
  
  //C (Furthest to right)
  fill(9, 95, 150, mouseX);
  quad(360, 177, 390, 170, 390, 320, 360, 320);
  fill(66, 151, 193, mouseX);
  quad(390, 170, 420, 180, 420, 320, 390, 320);
  
  //B (Just left of C, partially covering it in fact)
  fill(1, 54, 98, mouseX);
  rect(330, 160, 20, 150);
  fill(113, 168, 192, mouseX);
  quad(350, 160, 365, 165, 365, 320, 350, 320);
  
  //Buildings just beneath / in front of C
  fill(95, 77, 69, mouseX);
  rect(385, 270, 20, 90);
  
  fill(107, 96, 96, mouseX);
  rect(350, 300, 20, 60);
  fill(51, 35, 45, mouseX);
  rect(370, 300, 20, 60);
  
  //E (Almost the leftmost, has a pyramid on top)
  fill(1, 82, 111, mouseX);
  triangle(30, 240, 59, 240, 55, 225);
  fill(8, 97, 123, mouseX);
  triangle(58, 240, 75, 243, 55, 225);
  fill(56, 95, 119, mouseX);
  rect(30, 240, 28, 25);
  fill(108, 151, 161, mouseX);
  quad(58, 240, 75, 243, 75, 265, 58, 265);
  fill(56, 95, 119, mouseX);
  rect(25, 260, 30, 100);
  fill(108, 151, 161, mouseX);
  quad(55, 260, 80, 263, 80, 360, 55, 360);
  
  //G (Plain looking thin tall one to the right of A)
  fill(47, 74, 100, mouseX);
  rect(210, 220, 10, 100);
  fill(76, 116, 129, mouseX);
  quad(220, 220, 230, 222, 230, 320, 220, 320);
  
  fill(65, 69, 79);
  rect(200, 290, 20, 70);
  fill(44, 69, 79);
  quad(220, 290, 245, 292, 245, 360, 220, 360);
  
  //H (To the right of G)
  fill(18, 64, 94, mouseX);
  quad(268, 230, 277, 233, 277, 265, 268, 265);
  fill(59, 86, 105, mouseX);
  rect(253, 230, 15, 30);
  fill(59, 86, 105, mouseX);
  rect(250, 260, 20, 100);
  fill(18, 64, 94, mouseX);
  quad(270, 260, 280, 263, 280, 360, 270, 360);
  fill(48, 92, 97, mouseX);
  triangle(253, 230, 268, 230, 265, 210);
  fill(47, 134, 135, mouseX);
  triangle(268, 230, 277, 233, 265, 210);
  
  
  //D (Building with ball on top in front of B)
  fill(3, 85, 118, mouseX);
  ellipse(335, 245, 45, 45);
  fill(26, 93, 145, mouseX);
  rect(310, 240, 30, 120);
  fill(75, 94, 120, mouseX);
  quad(340, 240, 360, 245, 360, 360, 340, 360);
  
  //Building in front of D
  fill(117, 144, 171, mouseX);
  rect(295, 300, 25, 60);
  fill(64, 96, 121, mouseX);
  rect(320, 300, 15, 60);
  
  //I (Leftmost building, tan coloured)
  fill(191, 203, 185, mouseX);
  rect(0, 220, 10, 40);
  fill(75, 86, 100, mouseX);
  rect(0, 220, 10, 10);
  
  //Even more tan building peeking over I
  fill(131, 130, 125, mouseX);
  rect(0, 260, 20, 100);
  fill(5, 54, 83, mouseX);
  rect(0, 255, 15, 5);
  
  //Stadium (That black orb down there)
  fill(5, 16, 30);
  ellipse(95, 355, 40, 40);
  
  //F (Building with ball on top in front of A)
  fill(131, 157, 171);
  rect(115, 260, 25, 80);
  fill(76, 116, 135);
  quad(140, 260, 165, 263, 165, 285, 140, 285);
  fill(122, 135, 154);
  rect(110, 280, 35, 80);
  fill(39, 64, 86);
  quad(170, 283, 170, 360, 145, 360, 145, 280);
  quad(160, 300, 180, 303, 180, 360, 160, 360);
  
  //Buildings on road
  fill(43, 79, 99);
  rect(0, 325, 35, 35);
  
  fill(51, 54, 71);
  rect(0, 350, 170, 10);
  
  fill(77, 112, 139);
  rect(170, 340, 15, 20);
  fill(14, 21, 31);
  rect(185, 340, 10, 20);
  
  
  //Road
  rect(0, 358, 400, 2);
  
  //Trees
  fill(61, 128, 47, mouseX);
  rect(237, 350, 7, 7, 3);
  rect(252, 350, 7, 7, 3);
  rect(267, 350, 7, 7, 3);
  rect(282, 350, 7, 7, 3);
  rect(307, 350, 7, 7, 3);
  rect(322, 350, 7, 7, 3);
  rect(347, 350, 7, 7, 3);
  
  //Cars
  fill(245, 52, 75, mouseX);
  rect(-(140-(tan(frameCount * 0.015) * 400)), 356, 4, 2);
  rect(140-(tan(frameCount * 0.020) * 100), 356, 4, 2);
  fill(223, 222, 133, mouseX);
  rect(-(300-(tan(frameCount * 0.015) * 400)), 356, 4, 2);
  fill(137, 223, 133, mouseX);
  rect(20-(tan(frameCount * 0.015) * 400), 356, 4, 2);
  
  //Lights (On A's antenna)
  fill(234, 28, 28, (5 - (sin(frameCount * 0.045) * 50)) - (350 - mouseX));
  ellipse(140, 60, 4, 4);
  ellipse(140, 80, 6, 6);
  
  //Lake
  fill(28, 125, 175);
  rect(0, 360, 400, 40);
  //Lake Gradient
  fill(1, 96, 152, 175);
  rect(0, 360, 400, 10);
  fill(1, 96, 152, 100);
  rect(0, 370, 400, 10);
  fill(1, 96, 152, 50);
  rect(0, 380, 400, 10);
  
  
  
  // DESTROYED VERSION \\
  
  //I won't explain each comment because they are the same as the normal version
 
  //Sunset Gradient
  fill(38, 38, 38, 255 / 1.5 - mouseX);
  rect(0, 330, 400, 30);
  fill(38, 38, 38, 255 / 2 - mouseX);
  rect(0, 310, 400, 20);
  fill(38, 38, 38, 255 / 2.5 - mouseX);
  rect(0, 290, 400, 20);
  fill(38, 38, 38, 255 / 3 - mouseX);
  rect(0, 270, 400, 20);
  fill(38, 38, 38, 255 / 3.5 - mouseX);
  rect(0, 250, 400, 20);
  fill(38, 38, 38, 255 / 4.5 - mouseX);
  rect(0, 230, 400, 20);
  fill(38, 38, 38, 255 / 6 - mouseX);
  rect(0, 210, 400, 20);
  fill(38, 38, 38, 255 / 10 - mouseX);
  rect(0, 190, 400, 20);
  
  fill(38, 38, 38, 255 - mouseX);
  
  //Buildings so far in the background they need another section
  rect(280, 280, 20, 80);
  triangle(280, 280, 300, 280, 290, 270);
  
  //Background Buildings
  rect(80, 280, 20, 80);
  
  rect(95, 250, 30, 110);
  rect(95, 250, 30, 15);
  
  rect(170, 320, 50, 40);
  
  rect(15, 300, 10, 60);
  
  rect(240, 310, 15, 50);
  
  //A
  //fill(10, 114, 168, 255 - mouseX);
  quad(145, 205, 157, 210, 160, 263, 140, 263);
  //fill(155, 196, 221, 255 - mouseX);
  triangle(132, 170, 148, 185, 135, 320);
  quad(128, 170, 133, 170, 136, 320, 120, 270);
  
  //C
  quad(360, 230, 390, 223, 390, 320, 360, 320);
  triangle(390, 215, 390, 223, 378, 230);
  rect(380, 180, 3, 60);
  rect(373, 192, 2, 50);
  rect(360, 220, 5, 10);
  rect(390, 200, 20, 100);
  
  //B
  rect(385, 270, 20, 90);
  
  rect(350, 300, 20, 60);
  rect(370, 300, 20, 60);
  
  //F
  rect(115, 260, 25, 80);
  quad(140, 260, 165, 263, 165, 285, 140, 285);
  rect(110, 280, 35, 80);
  quad(170, 283, 170, 360, 145, 360, 145, 280);
  quad(160, 300, 180, 303, 180, 360, 160, 360);
  
  //E
  rect(30, 240, 28, 25);
  triangle(58, 240, 75, 265, 58, 265);
  rect(25, 260, 30, 100);
  quad(55, 260, 80, 263, 80, 360, 55, 360);
  
  //G
  triangle(230, 240, 230, 300, 210, 300);
  
  rect(200, 290, 20, 70);
  quad(220, 290, 245, 292, 245, 360, 220, 360);
  
  //H
  quad(268, 230, 277, 233, 277, 265, 268, 265);
  triangle(254, 232, 268, 260, 254, 260);
  triangle(268, 250, 268, 260, 254, 260);
  //rect(253, 230, 15, 30);
  rect(250, 260, 20, 100);
  quad(270, 260, 280, 263, 280, 360, 270, 360);
  
  //D
  rect(310, 240, 30, 120);
  quad(340, 240, 360, 245, 360, 360, 340, 360);
  
  rect(295, 300, 25, 60);
  rect(320, 300, 15, 60);
  
  //I
  rect(0, 260, 20, 100);
  rect(0, 255, 15, 5);
  
  //Buildings on road
  rect(0, 325, 35, 35);
  
  rect(0, 350, 170, 10);
  
  rect(170, 340, 15, 20);
  rect(185, 340, 10, 20);
  
    //Road
  rect(0, 358, 400, 2);
  
    //Lake
  fill(28, 125, 175, 255 - mouseX);
  rect(0, 360, 400, 40);
  //Lake Gradient
  fill(38, 38, 38, 255 / 2.5 - mouseX);
  rect(0, 360, 400, 10);
  fill(38, 38, 38, 255 / 3.5 - mouseX);
  rect(0, 370, 400, 10);
  fill(38, 38, 38, 255 / 4.5 - mouseX);
  rect(0, 380, 400, 10);
  
  //Overlay (Gives the image a spooky gray-orange look)
  fill(52, 39, 29, (255 / 2.5 - mouseX));
  rect(0, 0, 400, 400);

  
}