• fullscreen
  • space_needle_rain_cloud2.pde
  • float d;
    float x;
    float y;
    
    
    void setup() {
      size (500, 500);
      //change speed
      background (100); // background color
      smooth (); //set up smooth for the sketch
      x=-10;
      y=-10;
    }
    
    void draw () {
    
     //if SPACEBAR is pressed, the sky will clear
       if (key==' ') {
         frameRate (10);
         fill (100, d);
        rect (0, 0, height, width);
    
        d=80;
    
      } 
          //if r is pressed it will rain, with grey background      
      if (key=='r') {
    frameRate (60);
        x=random (1, width);
        y=random (1, height);
        fill (100, d);
        rect (0, 0, height, width);  
        d=10;
    
    
      }
      
     
      
      //if any other key is pressed, it will be a blue background
      
      else {
        
        x=-10;
        y=-10;
     fill (100, 100, 250, d);
      rect (0, 0, height, width);
          frameRate (5);
          d=5;
    
    }
    
      
    
      //rain 
      noStroke ();
      fill (100, 100, 250);
      ellipse (x, y, 10, 20);
    
    
    
    
      //Top point of Space Needle
      fill (200);
      noStroke ();
      triangle (203, 5, 198, 40, 205, 40);
    
      //base for point
      noStroke ();
      fill (200, 70, 5);
      rect (190, 40, 25, 15);
    
      //top of dome
      noStroke();
      fill (200, 70, 5);
      triangle (200, 50, 150, 65, 250, 65);
    
      //restaurant deck
      fill (0);
      rect (150, 65, 100, 5);
    
      //disk
      fill (200);
      beginShape ();
      vertex (150, 70);
      vertex (140, 75);
      vertex (150, 77);
      vertex (250, 77);
      vertex (260, 75);
      vertex (250, 70);
      endShape ();
    
      //Observation Deck
      fill (0);
      rect (155, 77, 90, 10);
    
      //left support top
      strokeWeight (7);
      stroke (200);
      line (165, 92, 185, 220);
    
      //left support bottom
      strokeWeight (9);
      line (185, 220, 147, 500);
      noStroke ();
    
    
    
      //elevator shaft
      fill (0);
      rect (185, 90, 30, 500);
    
    
      //disk below deck
      fill (200);
      ellipse (200, 89, 120, 8);
    
      //left support top L side
      strokeWeight (5);
      stroke (200);
      line (197, 92, 200, 180);
    
      //left support top R side
      strokeWeight (6);
      stroke (200);
      line (230, 92, 215, 180);
    
      //left support bottom left
      strokeWeight (5);
      stroke (200);
      line (201, 500, 201, 270);
    
      //left support bottom middle
      strokeWeight (5);
      stroke (200);
      line (225, 500, 215, 268);
    
      //left support bottom right
      strokeWeight (4);
      stroke (200);
      line (245, 500, 215, 270);
    
    
      //left support where they meet
      fill (200);
      beginShape ();
      vertex (200, 180);
      vertex (207, 183);
      vertex (215, 180);
      vertex (212, 220);
      vertex (214, 270);
      vertex (207, 267);
      vertex (200, 270);
      vertex (202, 220);
      vertex (200, 180);
      endShape ();
    
      //medium deck
      fill (200);
      ellipse (195, 340, 58, 3);
    
      //bottom deck
      fill (200);
      beginShape ();
      vertex (160,395);
      vertex (150, 400);
      vertex (160, 410);
      vertex (230, 410);
      vertex (240, 400);
      vertex (230, 395);
      vertex (160, 395);
      endShape ();
    
      //windows in bottom deck
      strokeWeight (4);
      stroke (0);
      line (150, 400, 197, 403);
      //contine windoes
      line (197, 403, 240, 400);
    
    } 
    
    
    
    
    
    
    //Function to make Clouds appear where and when Mouse is pressed
    
    void mousePressed() {
    
      pushMatrix ();
    
      translate (mouseX,mouseY);
      noStroke ();
      //cloud
    
      ellipse (0, 0, 150, 60);
      ellipse (-30, 10, 70, 50);
      ellipse (20, 10, 60, 60);
      ellipse (-40, -20, 50, 20);
      ellipse (-10, -15, 70, 50);
      ellipse (3, -15, 60, 40);
      popMatrix ();
      d=0;
    }
    

    code

    tweaks (0)

    about this sketch

    This sketch is running as Java applet, exported from Processing.

    This sketch is saved as a draft and it is not published on the homepage and browse page.

    license

    advertisement


    Andrew Lazarow

    Space Needle, with rain and clouds

    Add to Faves Me Likey@!
    You must login/register to add this sketch to your favorites.

    This is a quick sketch for my processing class at NYU's ITP.

    -Click the mouse to draw clouds, that will fade away over time.

    -Press Space Bar to Clear the sky, and have clouds fade away faster.

    -Press 'r' to make it rain.

    -Press any other key to go back to drawing the clouds.

    Note: some of the interactive features have problems in Google's Chrome Browser

    You need to login/register to comment.