//scribble global variables float x; float y; //text global variables PFont f; // holds font String[] poem; // array to hold all of the text int counter = 0; // start at beginning of text // scribble delimiters String delimiters = "e"; void setup() { //parameters for text viz size(320,240); smooth(); background(255); //start x and y x = width/2; y = height/2; // Load poem generated by automator into an array of strings String url = "poem.txt"; String[] rawtext = loadStrings(url); // Join the big array together as one long string String everything = join(rawtext, "" ); // All the lines in poem are first joined as one big String and then split up into an array of individual pieces based on the letter "e." poem = split(everything,delimiters); frameRate(5); } void draw() { // Pick one word from poem String theword = poem[counter]; // Count how many times that word appears in poem int total = 0; for (int i = 0; i < poem.length; i ++ ) { if (theword.equals(poem[i])) { total ++; } } // Display squares for this data stroke(random(0, total+100), 100, random(0, (total*2))); noFill(); rect((total*2), random(total, 100), 2, 2); // Move onto the next word counter = (counter + 1) % poem.length; //scribbler // A new x,y location is picked as the current (x,y) plus or minus a random value. // The new location is constrained within the window's pixels. float newx = constrain(x + random(-40,40),0,width); float newy = constrain(y + random(-40,40),0,height); // Draw a line from x,y to the newx,newy stroke(random(0, total), random(0, total+100), total+50, random(63, 255)); strokeWeight(4); line(x,y,newx,newy); // save the new location in (x,y) in order to start the process over again. x = newx; y = newy; }