// rss feed String url = "http://www.eco-os.org/livedata/"; //xml arrays XMLElement xml; XMLElement[] title; XMLElement[] pubDate; XMLElement[] value; float total = 0; float boxSize; float margin = boxSize*2; float depth = 400; color boxFill; void setup() { XMLElement rss = new XMLElement(this, url); title = rss.getChildren("channel/item/title"); pubDate = rss.getChildren("channel/item/pubDate"); value = rss.getChildren("channel/item/description"); for (int i = 0; i < title.length; i++) { if (title[i].getContent() != null) { if (title[i].getContent().indexOf("_stretch") > -1) { total = total + 1; } } } boxSize = total; size(330, 500, P3D); noStroke(); } void draw() { background(255); // Center and spin grid translate(width/2, height/2, -depth); rotateY(frameCount * 0.01); rotateX(frameCount * 0.01); // Build grid using multiple translations for (float i =- depth/2+margin; i <= depth/2-margin; i += boxSize){ pushMatrix(); for (float j =- height+margin; j <= height-margin; j += boxSize){ pushMatrix(); for (float k =- width+margin; k <= width-margin; k += boxSize){ // Base fill color on counter values, abs function // ensures values stay within legal range boxFill = color(abs(i), abs(j), abs(k), 50); pushMatrix(); translate(k, j, i); fill(boxFill); box(boxSize, boxSize, boxSize); popMatrix(); } popMatrix(); } popMatrix(); } }