Below is the final code and descriptions of the code:
import processing.xml.*; imports the xml library to parse xml data
XMLElement xml;
float [] list2; declares an array containing decimels
void setup() { sets up the application area and frame rate
size(600, 600);
list2 = new float[201]; initialises the array to hold 200 variables
frameRate(20);
}
void draw() { the draw function loops continuosly as the program runs
background(0); resets the backround to black to allow for redrwing the circles
xml = new XMLElement(this, “http://arch-os.scce.plymouth.ac.uk/xml_data.php?source=all_vis”); gets the data from the archos server
XMLElement kid = xml.getChild(4).getChild(3); finds the correct data line in the xml file
String xmlData = kid.getContent();
int list[] = int(split(xmlData, “, “)); splits the data line into seperate values
for (int i = 200; i > 0; i = i-1) { repeats the next code block for 200 times each time draw is executed
float a = random(20,255);
int b = int(a);
stroke(20*list[i],200,b); defines a random colour for each circle
noFill();
smooth();
if (list[i] < list2[i]){
ellipse(300, 300, (list2[i]*20), (list2[i]*20)); compares variables in list to list 2 and if smaller deincrements list2 variable by 0.1
list2[i] = (list2[i] – 0.1);
} else if (list[i] > list2[i]) {
ellipse(300,300, (list2[i]*20), (list2[i]*20)); compares variables in list to list 2 and if larger increments list2 variable by 0.1
list2[i] = (list2[i] + 0.01);
}else{
ellipse(300,300, (list2[i]*20), (list2[i]*20)); if list and list2 are the same just draws circle
}
}
}
I should have a copy up for download soon along with source code! Mean while enjoy this stunning youtube video!