// Modified from Daniel Shiffman's example // Thanks to Jelani & Matt Richard /**Enter your U.S. Zip Code or Location ID and press return. * */ float r = random(255); float g = random(255); float b = random(255); float r1 = random(255); float g1 = random(255); float b1 = random(255); float r2 = random(255); float g2 = random(255); float b2 = random(255); float r3 = random(255); float g3 = random(255); float b3 = random(255); PImage img; PFont f; String typing = ""; String savedZip = ""; String weather = ""; String city = ""; String date = ""; String code = ""; int temp = 0; String[] otherside; // The array to hold all of the text int counter = 0; int counterCounter = 0; int counterIncrement = 12; // speed of text display boolean hasZip = false; boolean imgReady = false; // We will use spaces and punctuation as delimiters String delimiters = " ,.?!;:[]-"; void setup() { smooth(); size(995,706); f = loadFont("Harrington-25.vlw"); //background(loadImage("wood_window_web2.jpg")); // println(temp); //show switch/case in print line frameRate(2); } void draw() { background(loadImage("wood_window_web3.jpg")); if(imgReady == true){ image(img,248,121); //placement of image } textFont(f); // textMode(SCREEN); fill(23); // almost true black // Display all the stuff we want to display textSize(25); text("What does it feel like out?",351,42); //text("Enter U.S. zip code & press return to get a reading.",65,485); fill(r1,g1,b1); textSize(25); fill(173,234,234); text(typing,99,450); //zip code input text(savedZip,99,450); //zip code fill(r2,g2,b2); text(temp,100,259); text("°F",140,259); // degrees farenheit fill(r3,g3,b3); text(city,778,450); //city location fill(0,245,255); text(weather,445,677); // some zip codes to try: 90210 - L.A., 10003 - Downtown NYC, 99501 - Anchorage, AK, // 96801 - Honolulu, HI, 85001 - Phoenix, AZ, 53201 - Milwaukee, WI // 98101 - Seattle, WA, 60601 - Chicago, IL // location !Ds Paris, France FRXX0076 - London, United Kingdom UKXX0085 // Cape Town, South Africa SFXX0010 - Manila, Philippines RPXX0017 // Hong Kong, China CHXX0049 - Singapore, Singapore SNXX0006 // Rio de Janeiro, Brazil BRXX0201 - Tehran, Iran IRXX0018 if (hasZip == true){ String theword = otherside[counter]; fill(9,249,17); textSize(25); text(theword,random(790,850), random(180,334)); //text(temp,550,175); if (counterCounter >= counterIncrement){ counter = (counter + 1) % otherside.length; // move onto the next word counterCounter = 20; } counterCounter ++; } // Draw a little thermometer based on the temperature // stroke(125); // fill(255,0,0); // rect(100,270,temp*2,20); } void keyPressed(){ //If the return key is pressed, save the String and clear it if (key == '\n'){ savedZip = typing; getWeather(savedZip); typing = ""; // allow img to be displayed in draw imgReady = true; } else { typing = typing + key; savedZip = ""; } } void getWeather(String saved) { //Get all the HTML/XML source code into an array of strings (each line is one element in the array) String url = "http://itp.nyu.edu/icm/proxy/proxy.php?url=http://xml.weather.yahoo.com/forecastrss?p=" + saved; // using our php proxy to allow it to work in a browser String[] lines = loadStrings(url); //for(int i=0;i