//Tricolor v.2007 by Cynthia Lawson Jaramillo //2012 version re-coded in Processing for the exhibition "CrossTalk: Speech Acts & Interference in Networked Art" //This version would not have been possible without the PhP proxy code by Shawn Van Every downloaded from // http://www.learningprocessing.com/tutorials/sandbox/ // and the following // feedParser.pde // // Reads RSS and Atom feeds. Requires ROME // (https://rome.dev.java.net/) // and JDOM (http://www.jdom.org/), just make // a code folder and copy "jdom.jar" and "rome-*.jar" // into it. // // Marius Watz - http://workshop.evolutionzone.com import com.sun.syndication.feed.synd.*; import com.sun.syndication.io.*; FeedReader feed; String feedurl; String message = ""; String stri; int tempy = 0; int TIMER = 50; // ms long lastTime; int NEXTLETTER = 0; int NEXTENTRY = 1; int NEXTLINE = 14; String tricolor = "amarillo"; float newWidth = 0; int xcoor = 0; PFont f; void setup() { background(255,255,255); f = loadFont("Serif-14.vlw"); size(800, 600); // load feed feedurl="http://cynthialawson.com/tricolor/proxy.php?url=http://www.eltiempo.com/colombia/rss.xml"; println("Loading feed: "+feedurl); feed=new FeedReader(feedurl); // print feed data println("Feed: "+feed.title); println("------------------------------"); println("Description: "+feed.description); println("Number of entries: "+feed.numEntries); println("------------------------------"); } void draw(){ if (tricolor == "amarillo") { fill (252,209,22); } else if (tricolor == "azul") { fill (0,56,147); } else { fill (206,17,38); } message = "" + (feed.entry[NEXTENTRY]); if (millis() - lastTime < TIMER) return; // Don't do anything before the delay lastTime = millis(); if (NEXTLETTER < message.length()) { text(message.charAt(NEXTLETTER),xcoor,NEXTLINE); newWidth = textWidth(message.charAt(NEXTLETTER)); NEXTLETTER+=1; if (xcoor > (width-4)) { xcoor = 0; NEXTLINE += 14; } else { xcoor += newWidth; } } else { if (NEXTENTRY < (feed.numEntries-1)) { NEXTENTRY += 1; NEXTLETTER=0; } else { NEXTENTRY = 1; } } if ((NEXTLINE >= height/2) && (NEXTLINE < (height*3)/4)) { tricolor = "azul"; } else if ((NEXTLINE >= (height*3)/4) && (NEXTLINE < (height + 14))) { tricolor = "rojo"; } else if (NEXTLINE > height) { tricolor = "amarillo"; NEXTLINE = int(random(14)); } }