fullscreen 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 (60);
fill (100, d);
rect (0, 0, height, width);
d=.5;
}
//if r is pressed it will rain, with grey background
// if P is pressed, the plane will appear
if (key=='p') {
fill (100);
rect (0, 0, height, width);
pushMatrix ();
translate (mouseX, mouseY);
fill (255);
noStroke ();
//airplane
ellipse (0, 0, 180, 25); // BODY
triangle (-10, -60, 0, 0, 30, 0); //Upper Wing
triangle (-25, 80, 0, 0, 30, 0); //Lower Wing
triangle (-57, 0, -77, 40, -77, -40);
beginShape ();
vertex (-60, -5);
vertex (-90, -40);
vertex (-94, -40);
vertex (-75, -5);
vertex (-60, -6);
endShape ();
popMatrix ();
}
if (key=='r') {
frameRate (10+.5*mouseX);
x=random (1, width);
y=random (1, height);
fill (100, d);
rect (0, 0, height, width);
d=10;
//rain
noStroke ();
fill (100, 100, 250);
ellipse (x, y, 10, 20);
}
//if any other key is pressed, it will be a blue background
else {
x=-10;
y=-10;
fill (100, d);
rect (0, 0, height, width);
frameRate (60);
d=.5;
}
//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;
}
This is another sketch for my processing course at NYU's ITP.
In this sketch the rain speed responds to the mouseX location. But you have to press 'r' to trigger the rain.
if you click 'p' you can fly a plane around the screen.
if you click the mouse, clouds will appear for a moment.
Any other key will 'clear the sky.' But, of course, it will stay nice and "Seattle" gray.