ptx =[];
pty =[];
ptx2 =[];
pty2 =[];
numberx =[];
numbery =[];var d;var angle;var pieceNum;var trapAngle =360/17;var r1 =280;var r2 =180;var bool =false;var table;var numRows;var pages ={
title1:[],
minititle1:[],
goal1:[],
goal2:[],
goal3:[],
goal4:[],
goal5:[],
r:[0,200,255,5,255,255,112,255,169,255,255,255,206,38,0,2,2,0],
g:[72,0,206,172,85,51,200,206,0,128,51,153,168,151,171,200,116,72],
b:[108,0,4,10,0,51,255,4,56,0,153,51,78,41,255,35,174,108],};var logo;functionpreload(){
table =loadTable("17goalsdata.csv","header");
logo =loadImage("logo.png");}functionsetup(){createCanvas(1000,600);
numRows = table.getRowCount();angleMode(DEGREES);imageMode(CENTER);for(var i =0; i <19; i++){
ptx[i]= r1*cos(7*trapAngle+((i+1)*trapAngle));
pty[i]= r1*sin(7*trapAngle+((i+1)*trapAngle));}for(var i =0; i <19; i++){
ptx2[i]= r2*cos(7*trapAngle+((i+1)*trapAngle));
pty2[i]= r2*sin(7*trapAngle+((i+1)*trapAngle));}for(var i =0; i <19; i++){
numberx[i]=((r1+r2)/2)*cos((7*trapAngle+((i+1)*trapAngle))+(trapAngle/2));
numbery[i]=((r1+r2)/2)*sin((7*trapAngle+((i+1)*trapAngle))+(trapAngle/2));}for(var i =0; i < numRows; i++){
pages.title1[i]= table.getString(i,"Title");
pages.goal1[i]= table.getString(i,"Goal1")
pages.goal2[i]= table.getString(i,"Goal2")
pages.goal3[i]= table.getString(i,"Goal3")
pages.goal4[i]= table.getString(i,"Goal4")
pages.goal5[i]= table.getString(i,"Goal5")
pages.minititle1[i]= table.getString(i,"MiniTitle");}}functiondraw(){push();translate(width/2,height/2);strokeWeight(10);noFill();background(220);image(logo,0,-20,1024*r1/879,r1);if(!bool){for(var i =0; i <19; i++){drawTrapezoid(i);}
angle =atan2(mouseY - height/2,mouseX - width/2);
pieceNum =8+ceil(angle/(trapAngle));
d =dist(width/2,height/2,mouseX,mouseY);menuSelector(d);}else{pop();if(d<r1 & d>r2){if(pieceNum==0){
pieceNum=17;}let col =color(pages.r[pieceNum],pages.g[pieceNum],pages.b[pieceNum]);drawTitle(pages.title1[pieceNum-1],col);drawGoals(pages,60);}drawExitButton();}}functiondrawExitButton(){stroke(0);fill(200,0,0);rect(width-105,height-105,100,100,20);fill(0);strokeWeight(1);text("Back",width-75,height-50)noStroke();}functiondrawTitle(title1,col){background(col);strokeWeight(10);stroke(0);line(5,5,width-5,5);line(5,5,5,height-5);line(5,height-5,width-5,height-5);line(width-5,height-5,width-5,5)strokeWeight(2);fill(255);rect(5,5,100,100,20);fill(0);strokeWeight(2);textSize(50);textAlign(CENTER)rectMode(CORNER);text(pieceNum,50,65);textSize(40)noStroke();text(title1,120,25,840,300);}functiondrawGoals(pages,spacing){fill(0);textAlign(LEFT)strokeWeight(2);textSize(30);text("By 2030:",100,200-spacing,800);textSize(20);for(var i =0; i <5; i++){text("Goal "+(i+1)+":",50,(i*spacing)+215);}text(pages.goal1[pieceNum-1],120,200,800);text(pages.goal2[pieceNum-1],120,200+spacing,800);text(pages.goal3[pieceNum-1],120,200+(2*spacing),800);text(pages.goal4[pieceNum-1],120,200+(3*spacing),800);text(pages.goal5[pieceNum-1],120,200+(4*spacing),800);}functiondrawTrapezoid(i){stroke(0);beginShape();vertex(ptx2[i],pty2[i]);vertex(ptx2[i+1],pty2[i+1]);vertex(ptx[i+1],pty[i+1]);vertex(ptx[i],pty[i]);endShape(CLOSE);rectMode(CENTER);noStroke();if(i<18& i>0){fill(0);textSize(17);textAlign(CENTER);rectMode(CENTER);text(i,numberx[i],numbery[i])noFill();} //rect(numberx[i],numbery[i],10,10);
rectMode(CORNER);}functionmousePressed(){if(d<r1 & d>r2){
bool =true;}if(mouseX>895& mouseY>485){
bool =false;}}functionmenuSelector(d){if(d<r1 & d>r2){for(var i =0; i <=18; i++){let col =color(pages.r[pieceNum],pages.g[pieceNum],pages.b[pieceNum])fill(col);ellipse(0,0,(2*r2)-5);noStroke();fill(0); //rectMode(CENTER);
textSize(30)text(pages.minititle1[pieceNum],-r2+10,-20,(2*r2)-5,(2*r2)-5);fill(col);drawTrapezoid(pieceNum);}}}
Steps to Run Project:
Go into “Final Project” folder a. Location: handin-14-finalproject –> btyi-14-project –> Final Project
Navigating to this location in your console/commandprompt/etc.
Run local host by typing [php -S localhost:8000] (may be different for non-Windows users)
Type in localhost:8000 into your Google Chrome URL bar
Description: My program is a simplified display of the 17 Sustainable Development Goals of the United Nations. Essentially, I have created a summary of all 17 Goals, which 5 of the sub-targets of each of these goals and created a display of all that information. Inside the Brainstorming folder, I put different drafts and other ideas I had made prior to completing my final draft. I also put all the information that I collected from the UN website into separate notes sheets before I converted to Excel, so those are located in the brainstorming folder as well.
Inspiration: Up until a couple of years ago, I had never heard of the 17 Sustainable Development Goals. Then when I learned about them, it surprised me that these goals weren’t more readily available and advertised worldwide. But when I looked into these 17 goals, I realized that there was so much content that was put on the website, that I had no idea where to start. Therefore, for this project, I wanted to create a summarized/simpler version of the UN’s website, with the basic and important information consolidated into one place. If I had more time, I would probably have wanted to add a little more information to the display, as well as make the transitions smoother and make the appearance look more professional. Functionality-wise, if I had more time I think I would have liked to add more user interaction, such as different operations using different keys on the keyboard, or maybe some sliders and other user-oriented devices.
In this game you try to keep the penguin alive. If the penguin touches the water you lose. the penguin has to jump between ice cubes floating across the screen. the ice cubes are objects stored in an array. the penguin can jump when it is touching the ice cube. two challenges appear while playing. one makes the ice cubes smaller, and one makes the ice cubes move faster. if you navigate through these challenges you can get to safety and win the game. I attached a video of me completing the game because it might not be a game you can complete first try.
I wanted to create a fun game that had a relation to climate change. since climate change is melting ice which might cause harm to wildlife, I made this game where the ice is melting. If I had more time I might add more challenges and make the movement of the ice cubes look more realistic, like they are actually in water.
//Anthony Pan
//Section C
//final project proposal final
//requirements:
//loops, arrays, conditionals (if), user interaction, transformations,
//functions (besides setup and draw),
//and use of at least one object definition of your own design.
//net object "line" "pushes" trash objects to the right of the canvas
// if trash objects are to the right of the line, update all of the ones to the right
//within certain number of pixels, x position of the trash objects will update and increase incrementally
//lin search particle loop
//if statement with mouseX
//capture value of mouseX at that instance to avoid bugs
//create seperate function that changes background color
// use series of if statements
//array and object for garbage 1
var garbage1Showing =[];var garbage1;
//array and object for garbage 2
var garbage2;var garbage2Showing =[];
//array and object for ocean details
var OceanDetail;var oceanDetailShowing =[];
//frame counter
var counter =0;var fishes =[];var fish;
//angle for rotation og garbage2 object
var angle =0;functionsetup(){createCanvas(500,200); //create objects for garbage 1
for(var i =0; i <8; i ++){
garbage1 =makeGarbage1(random(50,150),color(random(255)));
garbage1Showing.push(garbage1);} //create objects for garbage 2
for(var i =0; i <10; i++){
garbage2 =makeGarbage2(random(60,140));
garbage2Showing.push(garbage2);} //create objects for ocean details
for(var i =0; i <7; i++){
OceanDetail =makeOceanDetail(random(0,height),color(255));
oceanDetailShowing.push(OceanDetail);}for(var i =0; i <10; i++){
fish =makeFish();
fishes.push(fish);}}functiondraw(){ //change water color based on # of objects in water
waterChange(); //ocean detail functions
OceanDetailDisplay();removeOceanDetail();addNewOceanDetail();noStroke(); //garbage2 functions
garbage2DisplayandMove();removeGarbage2(); //garbage1 functions
garbage1DisplayandMove();removeGarbage1(); //add new garbage to ocean based on probability
addNewGarbage1();addNewGarbage2(); //display fish if water is blue to dark blue
if(garbage1Showing.length >0& garbage1Showing.length <=40){displayFish();} //draw net
fill(255);noStroke();rect(mouseX,0,2,400); //check if garbage is ahead of net, if so use net to push them off screen
checkGarbage1Ahead();checkGarbage2Ahead();}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//fish code
//fish constructor
functionmakeFish(){var fish ={x:random(25,600), y:random(25,220),
speed:random(-0.2,0.2),
c:color(10,10,random(255)),
draw: drawFish,
move: moveFish
}return fish;}
//draw fish shape
functiondrawFish(){fill(this.c);push();scale(0.8); //transformation
ellipse(this.x,this.y,20,10); //direction of fish indicates which way tail is facing
if(this.speed <0){triangle(this.x+10,this.y,this.x+15,this.y-5,this.x+15,this.y+5);}else{triangle(this.x-10,this.y,this.x-15,this.y-5,this.x-15,this.y+5);}pop();}
//move fish
functionmoveFish(){this.x +=this.speed; //hits random point within canvas, fish will turn other direction
if(this.x > width -random(50)||this.x <random(50)){this.speed =-this.speed;}}
//one function to display and move fish on canvas
functiondisplayFish(){for(var i =0; i < fishes.length; i++){
fishes[i].move();
fishes[i].draw();}}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//type garbage1 functions
//garbage1 constructor
functionmakeGarbage1(gy, c){var garbage1 ={x:-10, y: gy,
speed:random(0.05,0.75),
Yspeed:random(0,0.2),
size:random(1,6),
fill: c,
move: garbage1Move,
draw: garbage1Draw }return garbage1;}
//draw garbage1
functiongarbage1Draw(){fill(this.fill);ellipse(this.x,this.y,this.size,this.size);}
//move garbage1
functiongarbage1Move(){this.x +=this.speed;this.y +=this.Yspeed;if(this.y >=150||this.y <=50){this.Yspeed =-this.Yspeed;} //to slow down at the middle and collect
if(this.x >= width/2){this.speed =0.001;}}
//1 function to move and draw garbage
functiongarbage1DisplayandMove(){for(var i =0; i < garbage1Showing.length; i++){
garbage1Showing[i].move();
garbage1Showing[i].draw();}}
//make new garbage based on probability
functionaddNewGarbage1(){var newGarbage1likelihood =0.01;if(random(0,1)< newGarbage1likelihood){
garbage1Showing.push(makeGarbage1(random(50,150),color(random(255))));}}
//remove garbage off screen
functionremoveGarbage1(){var garbage1ToKeep =[];for(var i =0; i < garbage1Showing.length; i++){if(garbage1Showing[i].x < width){
garbage1ToKeep.push(garbage1Showing[i]);}}
garbage1Showing = garbage1ToKeep; // remember the showing garbage2
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//garbage2 functions
//garbage 2 constructor
functionmakeGarbage2(gy){var garbage2 ={x:-10, y: gy,
speed:random(0.1,0.3),
Yspeed:random(0,0.2),
size:random(2,7),
r:random(255),
g:random(255),
b:random(255),
move: garbage2Move,
draw: garbage2Draw }return garbage2;}
//draw garbage 2
functiongarbage2Draw(){rectMode(CENTER); //garbage spins
push();translate(this.x,this.y);rotate(radians(angle));
angle +=0.1;fill(this.r,this.g,this.b);rect(0,0,this.size,this.size);pop();}
//move garbage 2
functiongarbage2Move(){this.x +=this.speed;this.y +=this.Yspeed;if(this.y >=140||this.y <=60){this.Yspeed =-this.Yspeed;} //to slow down at the middle and collect
if(this.x >= width/2){this.speed =0.001;}}
//1 function to draw and move garbage
functiongarbage2DisplayandMove(){for(var i =0; i < garbage2Showing.length; i++){
garbage2Showing[i].move();
garbage2Showing[i].draw();}}
//remove garbage 2 if off screen
functionremoveGarbage2(){var garbage2ToKeep =[];for(var i =0; i < garbage2Showing.length; i++){if(garbage2Showing[i].x < width){
garbage2ToKeep.push(garbage2Showing[i]);}}
garbage2Showing = garbage2ToKeep; // remember the showing garbage2
}
//add new garbage periodically
functionaddNewGarbage2(){var newGarbage2likelihood =0.01;if(random(0,1)< newGarbage2likelihood){
garbage2Showing.push(makeGarbage2(random(50,150)));}}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//make ocean details
//make ocean detail object
functionmakeOceanDetail(oy, c){
OceanDetail ={x:0, y: oy,
speed:random(0.1,0.3),
fill: c,
move: oceanDetailMove,
draw: oceanDetailDraw }return OceanDetail;}
//move ocean detail
functionoceanDetailMove(){this.x +=this.speed;}
//drawocean details
functionoceanDetailDraw(){noFill();strokeWeight(0.2);stroke(this.fill);curve(this.x,this.y,this.x +10,this.y -10,this.x +10,this.y -20,this.x,this.y -30);}
//1 function to draw and move ocean details
functionOceanDetailDisplay(){for(var i =0; i < oceanDetailShowing.length; i++){
oceanDetailShowing[i].move();
oceanDetailShowing[i].draw();}}
//remove ocean details if off screen
functionremoveOceanDetail(){var oceansToKeep =[];for(var i =0; i < oceanDetailShowing.length; i++){if(oceanDetailShowing[i].x < width){
oceansToKeep.push(oceanDetailShowing[i]);}}
oceanDetailShowing = oceansToKeep; // remember the showing ocean details
}
//add new ocean details periodically
functionaddNewOceanDetail(){
counter +=1;if(counter %100==0){
oceanDetailShowing.push(makeOceanDetail(random(40,height-40),color(255)));}}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//change background color based on number of garbage objects on the screen
//make this change more gradual
functionwaterChange(){if(garbage1Showing.length <=20){background(20,100,255);}if(garbage1Showing.length >20& garbage1Showing.length <=40){background(51,89,163);}if(garbage1Showing.length >40& garbage1Showing.length <=60){background(59,81,125);}if(garbage1Showing.length >60& garbage1Showing.length <=100){background(59,117,125);}if(garbage1Showing.length >100& garbage1Showing.length <=120){background(59,125,90);}if(garbage1Showing.length >120& garbage1Showing.length <=140){background(56,74,43);}if(garbage1Showing.length >140& garbage1Showing.length <=160){background(43,54,36);}if(garbage1Showing.length >=160){background(69,57,42);}}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//functions that check if particles are ahead of net
functioncheckGarbage1Ahead(){for(var i =0; i < garbage1Showing.length; i++){if(garbage1Showing[i].x > mouseX & garbage1Showing[i].x < mouseX +10){
garbage1Showing[i].x = mouseX +6;}}}functioncheckGarbage2Ahead(){for(var i =0; i < garbage2Showing.length; i++){if(garbage2Showing[i].x > mouseX & garbage2Showing[i].x < mouseX +10){
garbage2Showing[i].x = mouseX +6;}}}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
For my final project, I have created an ocean clean-up interaction program. Ocean plastics contribute to the rapid increase in the rate of climate change because it acts as a carbon sink. Thus, cleaning up ocean plastics is imperative to slow down the rate of climate change in addition to protecting ocean life.
This program aims to create an abstraction of ocean clean-up and the adverse effects on the environment if pollution is left unattended for too long. The water starts off as a nice, blue color with fish swimming around. Waves are added as extra details to keep the canvas somewhat recognizable as the ocean. As the program continues, trash enters from the left side of the canvas. The trash is represented by randomized rectangles and circles of varying colors and sizes. These objects float towards the center of the canvas on randomized paths. They begin to collect in the middle of the screen, clumping together into a massive garbage patch. As the number of trash objects enters the scene, the water begins to dirty, from a clear blue to a muddy brown—if left out for too long. The fish die-off as the trash on the canvas reaches a certain number.
However, the user is equipped with a net that can be used to clean the garbage. The net is represented by a long, white rectangle. The net works by identifying if a garbage object is within a certain threshold in front of the net. If the trash is within a certain distance in front of the net, it will be sucked in by the net. The user can then use mouseX to push the garbage off the screen to clean the ocean! As trash leaves the screen from the right side of the canvas, the water becomes blue once more. Remember that the net cannot move too fast. If the user is too hasty with their movements of the net, the trash may fall out of the net. Slowly moving the trash off the canvas is the most effective method of cleaning the ocean!
What inspired me to create this program is a video on YouTube by The Ocean Cleanup. They were able to develop a method of cleaning plastics and other pollutants in oceans around the world. They are specifically focusing on cleaning up the Great Pacific Garbage Patch.
If I had more time, I would like to add more detail to the ocean to make the entire program more visually appealing. I would also have liked to use particles and strings to create the net instead of a rectangle. However, I couldn’t figure out how to create a net that you could drag all the particles at once.
In order to run this program, all you have to do is open the index file into the browser of your choice!
My program is an interactive informative video on hurricanes. Climate change is causing hurricanes to become more powerful and I wanted to explore this for this project. I did not really know what I wanted to do for this project when we first got it, but I decided on hurricanes because I have been affected by them. I remember when I was little Hurricane Sandy hitting Connecticut and being without power for weeks. Halloween was cancelled because of power-lines being down and there being over 2 feet of snow. I remember playing cards with my family around candles and putting our food from the freezer out in the snow because we did not have a generator.
I wanted to make this project be special to me, but also make people realize that climate change is affecting us, because most people who do not believe climate change is serious does not know how much a degree or two in earths temperature rising can cause.
To use my program is simple. All you need to do is use the arrow and shift key when asked to see more information and explore more hurricanes. You can pick what hurricanes to see in any order.
If I had more time I think I would have explored adding some sounds, and possibly a conclusion at the end.
var dirY =10;var xCenter =35;var yCenter =26;var size1 =30;var size2 =75;var psize =1;var hsize =1;var winds =[];var offset =0;var a =0;var b =0;var x =[]; //for bacteria
var y =[]; //for bacteria
var dx =[]; //for bacteria
var bacteria =[];var changeHurricane =0;var counter=0;var time =50;functionpreload(){
bacteriaImg =loadImage("https://i.imgur.com/1A8JGL4.png");
harveyImg =loadImage("https://i.imgur.com/EpbTXxl.png");
hurricaneImg =loadImage("https://i.imgur.com/odCOO2g.png");
irmaImg =loadImage("https://i.imgur.com/1bhgnMC.png");
katrinaImg =loadImage("https://i.imgur.com/US5Kww2.png");
mapImg =loadImage("https://i.imgur.com/dOw7Qhi.png");
mudslideImg =loadImage("https://i.imgur.com/mvmq6d4.png");
peopleImg =loadImage("https://i.imgur.com/6md7EQY.png");
powerlinesImg =loadImage("https://i.imgur.com/fceH7Sn.png");
SandyImg =loadImage("https://i.imgur.com/v3yDJ4E.png");
shorelineImg =loadImage("https://i.imgur.com/b8jOnfe.png");
snowImg =loadImage("https://i.imgur.com/o4kwP6r.png");
tornadoImg =loadImage("https://i.imgur.com/fQdemYk.png");
sickbedImg =loadImage("https://i.imgur.com/f3pLBpr.png");
wasteFacilityImg =loadImage("https://i.imgur.com/DkcHFPS.png");
coastWaterImg =loadImage("https://i.imgur.com/Z3WagWz.png");
womenImg =loadImage("https://i.imgur.com/cYQjOwi.png");}functionsetup(){createCanvas(800,800);frameRate(50);var pl =wind(600,100,100);
winds.push(pl);for(var i =0; i <40; i++){
bacteria[i]=newObject();
bacteria[i].x =random(0,800);
bacteria[i].y =random(0,500);
bacteria[i].dx =random(-5,5);}}functionpeople2(r, c, rw, cw, x, y){push();translate(0,-490);for(var row =1; row <= r; row +=1){for(var col =1; col <= c; col +=1){image(peopleImg,(size1 * col)- x,(size2 * row)+ y, size1, size2);}}for(var row =6; row <= rw; row +=1){for(var col =1; col <= cw; col +=1){image(peopleImg,(size1 * col)- x,(size2 * row)+ y, size1, size2);}}pop();}functiondrawPeopleScale2(r, c, rw, cw, x, y, z){push();scale(psize);people2(r, c, rw, cw, x, y);
psize = psize - z;pop();}functionpeople(r, c, x, y){push();translate(0,-490);for(var row =1; row <= r; row +=1){for(var col =1; col <= c; col +=1){image(peopleImg,(size1 * col)- x,(size2 * row)+ y, size1, size2);}}pop();}functiondrawPeopleScale(r, c, x, y, z){push();scale(psize);people(r, c , x, y);
psize = psize - z;pop();}functionpowerlines(){image(powerlinesImg,300,260,400,326);}functionrisingSeas(c, d){fill(0,0,255);rect(0, d - dirY,800,1500);
dirY = dirY + c;}functionhouses4flooding(c, d){push();fill(255);scale(6);risingSeas(c, d);for(var col =1; col <=3; col +=1){triangle((xCenter * col)-5,20+ yCenter,(xCenter * col)-20, yCenter +37,(xCenter * col)+10,15+ yCenter +22);rect((xCenter * col)-20,37+ yCenter,30,25);rect((xCenter * col)-8,52+ yCenter,10,10);}pop();}functiondrawHouseOG(){push();fill(255);scale(8);triangle(15+ xCenter,0+ yCenter,0+ xCenter,15+ yCenter,30+ xCenter,15+ yCenter);rect(0+ xCenter,15+ yCenter,30,25);rect(12+ xCenter,30+ yCenter,10,10);pop();}functiondrawHouse(r, c){push();fill(255);for(var row =1; row <= r; row +=2){for(var col =1; col <= c; col +=1){ //draw house numbers
triangle((15+ xCenter * col)-30,(0+ yCenter * row)-2000,(xCenter * col)-30,(15+ yCenter * row)-2000,(30+ xCenter * col)-30,(15+ yCenter * row)-2000);rect((xCenter * col)-30,(15+ yCenter * row)-2000,30,25);rect((12+ xCenter * col)-30,(30+ yCenter * row)-2000,10,10);}}pop();}functiondrawHouseScale(r, c, z){push();scale(hsize);drawHouse(r, c);
hsize = hsize - z;pop();}functionstormSurge(y, w, h){push();noStroke();fill(0,0,255);rect(0, y, w, h)pop();drawHouseOG();}functionbacteriaWater(b){image(bacteriaImg, b.x, b.y,50,72.3);}functiontornadoes(){for(var col =1; col <=5; col +=1){image(tornadoImg,(150* col)-130,190,150,154);}}functionwind(px, py, pw){var p ={x: px, y: py, w: pw,
right: windRight};return p;}functionwindRight(){returnthis.x +this.w;}functionrisingTemperature(){fill(0+ a,0,255- a)rect(0,-height /3,800,800)
a = a +5;}functioncoastalRise(){image(shorelineImg,0,100,800,453.23)image(coastWaterImg,440- b,135,1200,406.23);
b = b +3;}functioncirclesForMap(){noStroke();fill(0,153,153); //teal
circle(660,320,40,40); //irma
fill(0,76,153); //blue
circle(680,75,40,40); //sandy
fill(0,153,0); //green
circle(520,270,40,40); //katrina
fill(102,102,0); //mustard
circle(450,280,40,40); //Harvey
}functionsandy(){fill(180)rect(0,0, width, height);fill(255);translate(0, height/3);textSize(12);textFont('Georgia');if(counter <= time *5){text("Hurricane Sandy,",50,15);text("October 30-31, 2012",50,30); //show map of area
image(SandyImg,0,-300,800,1151.22)}if(counter <= time *9& counter > time *5){text("Hurricane Sandy is the largest Atlantic Hurricane on record.",50,15);}if(counter <= time *14& counter > time *9){people2(12, width,13,15,30,-1);push();fill(0);text("Loss of Life: 285",50,15); //loop many people
pop();}if(counter <= time *19& counter > time *14){text("extreme highwind damage",50,15); //wind do in final folder
for(var i =0; i < winds.length; i++){var p = winds[i];rect(p.x - offset, p.y, p.w,10);}
offset +=90;if(winds.length >0& winds[0].right()< offset){
winds.shift();}var lastWind = winds[winds.length-1];if(lastWind.right()- offset < width){var p =wind(lastWind.right(), // start location
random(-height/3, height),100);
winds.push(p);}}if(counter <= time *24& counter > time *19){text("Storm surge levels up to almost 14ft",50,15); //people with water level
stormSurge(400,800,140);}if(counter <= time *29& counter > time *24){text("heavy snow damage",50,15); //snow image
image(snowImg,-130,-220,1000,800);}if(counter <= time *34& counter > time *29){houses4flooding(.6,420);text("flooding",50,15); //display water over houses, use loops for houses
}if(counter <= time *38& counter > time *34){text("mudslides",50,15); //show mudslide image
image(mudslideImg,0,105,800,427.7);}if(counter <= time *42& counter > time *38){text("8 million people lost power",50,15); //power lines
powerlines();}if(counter <= time *44& counter > time *42){drawHouseScale(250,160,.008);push();fill(0);textSize(18);text("20,000+ households were still displaced even after one year.",50,15); //house
pop();}if(counter > time *44){text("click the shift key to return to map to explore more",50,15);}}functionkatrina(){fill(180)rect(0,0, width, height);fill(255);translate(0, height/3);textSize(12);textFont('Georgia');if(counter <= time *5){text("Hurricane Katrina",50,15);text("August 23-30, 2005",50,30); //show map of area
image(katrinaImg,0,-320,800,1151.22)}if(counter <= time *10& counter > time *5){push();fill(0);drawPeopleScale2(24,75,25,33,-50,-200,.006);text("Loss of Life: 1833",50,15); //loop many people
pop();}if(counter <= time *14& counter > time *10){text("Storm surge levels up to 30ft",50,15); //compare to house
stormSurge(200,800,400);}if(counter <= time *19& counter > time *14){text("wind damage",50,15); //show wind in final folder
for(var i =0; i < winds.length; i++){var p = winds[i];rect(p.x - offset, p.y, p.w,10);}
offset +=70;if(winds.length >0& winds[0].right()< offset){
winds.shift();}var lastWind = winds[winds.length-1];if(lastWind.right()- offset < width){var p =wind(lastWind.right(), // start location
random(-height/3, height),100);
winds.push(p);}}if(counter <= time *23& counter > time *19){houses4flooding(.1,420);text("flooding",50,15); //display water over houses, use loops for houses
}if(counter <= time *30& counter > time *23){push();fill(0,0,255);rect(0,0,800,800);pop();for(var i =0; i <40; i++){bacteriaWater(bacteria[i]);
bacteria[i].x = bacteria[i].x + bacteria[i].dx;pop();}text("an absense of sanitation and bacteria-rich flood waters caused a public emergency",50,15); //bacteria in water
}if(counter <= time *34& counter > time *30){image(peopleImg, size1 +200,150, size1 *5, size2 *5);image(womenImg, size1 *7+200,150, size1 *5, size2 *5);fill(0);text("30,000 people seeking shelter under New Orleans Super Dome",50,15); //people and women
}if(counter <= time *39& counter > time *34){image(peopleImg, size1 +200,150, size1 *5, size2 *5);image(womenImg, size1 *7+200,150, size1 *5, size2 *5);fill(0);text("and 25,000 people seeking shelter under the Convention Center",50,15); //people and women
}if(counter > time *39){text("click the shift key to return to map to explore more",50,15);}}functionharvey(){fill(180)rect(0,0, width, height);fill(255);translate(0, height/3);textSize(12);textFont('Georgia');if(counter <= time *5){text("Hurricane Harvey",50,15);text("August 25-31, 2017",50,30);//show map of area
image(harveyImg,0,-320,800,1151.22);}if(counter <= time *9& counter > time *5){push();fill(0);people2(8,11,9,1,-200,225);text("Loss of Life: 89",50,15); //loop many people dome
pop();}if(counter <= time *14& counter > time *9){text("12.5ft storm surge",50,15); //show with people
stormSurge(420,800,120);}if(counter <= time *19& counter > time *14){houses4flooding(.1,420);text("extreme rainfall caused massive flooding",50,15); //houses and water
}if(counter <= time *23& counter > time *19){fill(0);drawPeopleScale(150,300,20,50,.006);text("displacing over 30,000",50,15);}if(counter <= time *23.5& counter > time *23){fill(0);drawHouseScale(500,400,.05);text("destroying over 200,000 households and businesses.",50,15); //houses
}if(counter <= time *27.5& counter > time *23.5){text("Harvey flooded 800 waste-water treatment facilities",50,15); //treatment facility
image(wasteFacilityImg,100,100,600,339);}if(counter <= time *34& counter > time *27.5){push();fill(0,0,255);rect(0,0,800,800);pop();for(var i =0; i <40; i++){bacteriaWater(bacteria[i]);
bacteria[i].x = bacteria[i].x + bacteria[i].dx;pop();}text("spreading sewage and toxic chemicals into flooded areas",50,15); //bacteria in water
}if(counter <= time *41& counter > time *34){image(sickbedImg,-20,-300,800,1151.2);text("disruption to water supplies and power systems caused water borne illness",50,15); //sick bed
}if(counter > time *41){text("click the shift key to return to map to explore more",50,15);}}functionirma(){fill(180)rect(0,0, width, height);fill(255);translate(0, height/3);textSize(12);textFont('Georgia');if(counter <= time *5){text("Hurricane Irma",50,15);text("September 6-12, 2017",50,30);//show map of area
image(irmaImg,0,-300,800,1151.22);}if(counter <= time *9& counter > time *5){push();fill(0);people2(5,26,6,4,20,325);text("Loss of Life: 134",50,15); //loop many people
pop();}if(counter <= time *14& counter > time *9){text("severe wind",50,15); //wind but faster
for(var i =0; i < winds.length; i++){var p = winds[i];rect(p.x - offset, p.y, p.w,10);}
offset +=70;if(winds.length >0& winds[0].right()< offset){
winds.shift();}var lastWind = winds[winds.length-1];if(lastWind.right()- offset < width){var p =wind(lastWind.right(), // start location
random(-height/3, height),100);
winds.push(p);}}if(counter <= time *19& counter > time *14){text("five tornadoes formed in South Florida causing more damage",50,15);tornadoes();}if(counter <= time *24& counter > time *19){text("max wind sustained was 185 mph for 37 hours",50,15); //faster faster wind
for(var i =0; i < winds.length; i++){var p = winds[i];rect(p.x - offset, p.y, p.w,10);}
offset +=99;if(winds.length >0& winds[0].right()< offset){
winds.shift();}var lastWind = winds[winds.length-1];if(lastWind.right()- offset < width){var p =wind(lastWind.right(), // start location
random(-height/3, height),100);
winds.push(p);}}if(counter <= time *28& counter > time *24){text("1.5 million people lost power",50,15); //power lines
powerlines();}if(counter <= time *28.6& counter > time *28){drawHouseScale(500,266,.05);fill(0);text(" and 133,000 homes were affected",50,15); //homes
}if(counter > time *28.6){text("click the shift key to return to map to explore more",50,15);}}functionstartText(){fill(255);translate(0, height/3);textSize(12);textFont('Georgia');if(counter <= time *3){text("Climate Change is ruining our planet, and we are the ones to blame.",50,15);}if(counter <= time *5& counter > time *3){//image here
text("seas are rising,",50,15);risingSeas(3,420);}if(counter <= time *7& counter > time *5){push();risingTemperature();pop();text("tempetures are rising,",50,15);}if(counter <= time *10& counter > time *7){image(hurricaneImg,0,-200,800,609,23);push();fill(145);text("and hurricanes are becoming more intense.",150,15);pop();}if(counter <= time *15& counter > time *10){push();risingSeas(.1,420);drawHouseOG();pop();text("hurricanes are and will cause extreme flooding",50,15);}if(counter <= time *20& counter > time *15){ //function here
text("and intense wind;",50,15);for(var i =0; i < winds.length; i++){var p = winds[i];rect(p.x - offset, p.y, p.w,10);}
offset +=50;if(winds.length >0& winds[0].right()< offset){
winds.shift();}var lastWind = winds[winds.length-1];if(lastWind.right()- offset < width){var p =wind(lastWind.right(), // start location
random(-height/3, height),100);
winds.push(p);}}if(counter <= time *25& counter > time *20){ //image here
text("causing massive coastal damage.",50,15);coastalRise();}if(counter > time *25){ //20 seconds to choose hurricane before intro restart
image(mapImg,0,-450,800,1151.22);text("KeyPress to discover the destruction of some of the last two decades worst hurricanes.",50,-215);fill(0,76,153);text("press up arrow on keyboard to see statistics of Hurricane Sandy",50,-200);fill(0,153,153);text("press down arrow on keyboard to see statistics of Hurricane Irma",50,-185);fill(0,153,0);text("press right arrow on keyboard to see statistics of Hurricane Katrina",50,-170);fill(102,102,0);text("press up left on keyboard to see statistics of Hurricane Harvey",50,-155);circlesForMap();}}functiondraw(){background(180);push();startText();pop();if(changeHurricane ==1){fill(180)rect(0,0-267, width, height);sandy();}if(changeHurricane ==2){fill(180)rect(0,-267, width, height);katrina();}if(changeHurricane ==3){fill(180)rect(0,-267, width, height);harvey();}if(changeHurricane ==4){fill(180)rect(0,-267, width, height);irma();}if(changeHurricane ==5){ //for map
fill(180)rect(0,-height/3+267, width, height);image(mapImg,0,-190,800,1151.22);fill(255);text("KeyPress to discover the destruction of some of the last two decades worst hurricanes.",50,52);fill(0,76,153);text("press up arrow on keyboard to see statistics of Hurricane Sandy",50,67);fill(0,153,153);text("press down arrow on keyboard to see statistics of Hurricane Irma",50,82);fill(0,153,0);text("press right arrow on keyboard to see statistics of Hurricane Katrina",50,97);fill(102,102,0);text("press up left on keyboard to see statistics of Hurricane Harvey",50,112);push();translate(0,267);circlesForMap();pop();}
counter+=1}functionkeyPressed(){
counter =0;if(keyCode == UP_ARROW){
changeHurricane =1;}if(keyCode == RIGHT_ARROW){
changeHurricane =2;}if(keyCode == LEFT_ARROW){
changeHurricane =3;}if(keyCode == DOWN_ARROW){
changeHurricane =4;}if(keyCode == SHIFT){
changeHurricane =5;}} //Links to info used:
//https://www.c2es.org/content/extreme-weather-and-climate-change/
//https://www.dosomething.org/us/facts/11-facts-about-hurricane-sandy
//https://www.britannica.com/event/Hurricane-Katrina
//https://www.lamar.edu/_files/documents/resilience-recovery/grant/recovery-and-resiliency/hurric2.pdf
//https://www.weather.gov/mfl/hurricaneirma
//https://www.worldvision.org/disaster-relief-news-stories/2017-hurricane-irma-facts