//import java.util.regex.*; //import java.io.*; //String twitterURL = "http://twitter.com/#search?q=%23soundcheck"; String query = "xfactor"; String since = "2009-12-01"; String twitterURL = "http://search.twitter.com/search.atom?q="+query+"&since="+since; String regex1 = "<(.|\n)+?>"; String proxyHost="hawkeye.pfpcint.com"; String proxyPort="8080"; String paramProxyHost="proxyHost"; String paramProxyPort="proxyPort"; String[][] content; float verticalVelocity=0.0; float verticalAcceleration=0.1; PImage b; String currentTweetTxt; void setup() { size(640,480); background(0); smooth(); frameRate(8); PFont font=loadFont("ChocolateBox-32.vlw"); b = loadImage("titlecard.jpg"); image(b, 0, 0); textFont(font); if (param("query")!=null) query=param("query"); if (param("since")!=null) since=param("since"); twitterURL = "http://search.twitter.com/search.atom?q="+query+"&since="+since; println("retrieving "+twitterURL); currentTweetTxt=""; if (param(paramProxyHost)!=null) System.setProperty("http.proxyHost", param(paramProxyHost)); else System.setProperty("http.proxyHost", proxyHost); if (param(paramProxyPort)!=null) System.setProperty("http.proxyPort", param(paramProxyPort)); else System.setProperty("http.proxyPort", proxyPort); // Download RSS feed of tweets tagged with [query] refreshTweets(twitterURL); } void draw(){ fill(0,16); rect(0,0,screen.width,screen.height); image(b, 0, 0); // b.blend(0, 0, screen.width, screen.height, 0, 0, screen.width, screen.height, MULTIPLY); textAlign(CENTER,CENTER); fill(255); textSize(32); if (content.length>0) text("\""+content[0][0]+"\"",width/5,0,width*3/5,height); // fill(128); // textSize(24); // text(content[i][1],x+20,y+8); // // fill(72); // textSize(24); // text(content[i][2],x+20,y+16); // popMatrix(); // } //add noise drawRandomLines(); //tint screen fill(70,45,0,80); rect(0,0,width,height); if (int(millis()/1000.0)%10==0){ refreshTweets(twitterURL); } } void drawRandomLines(){ stroke(255,int(random(16,64))); strokeWeight(int(random(1,3))); for (int i=0;i<10;i++){ int x1=int(random(0,screen.width)); int x2=x1+5*int(random(-5,5)); line(x1,0,x2,screen.height); } boolean bCircle = (random(0,1)<0.1); if (bCircle){ int x=int(random(0,screen.width)); int y=int(random(0,screen.height)); int r=int(random(20,60)); stroke(255,int(random(16,32))); strokeWeight(int(random(2,4))); ellipse(x,y,r,r); } } void refreshTweets(String url){ println("refreshing Tweets"); XMLElement xml = new XMLElement(this, url); XMLElement entries[] = xml.getChildren("entry"); content=new String[entries.length][3]; println(entries.length + " tweets retrieved"); if (entries.length>0){ // for (int j=0;j"); tweet=tweet.replaceAll(regex1,""); content[i][0]=tweet; content[i][1]=name; content[i][2]=published; currentTweetTxt = tweet; } else{ content[i][0]=""; content[i][1]=""; content[i][2]=""; } } } void keyPressed(){ refreshTweets(twitterURL); } float verticalTranslate(){ // return (20+millis()/80.0*verticalVelocity); return 0; }