PImage p; PFont f; int indent = 25; int numberImages = 8; float imagex; float imagey; String instrucciones = "Type a word. Hit return. Wait a moment. When images appear, move your mouse. Press TAB to enter new word."; String typing = ""; // Var to store text currently being typed String textentry = ""; // Var to store saved text when return is hit String tesauro = "http://stage.itp.nyu.edu/icm/proxy/proxy.php?url=http://thesaurus.reference.com/search?q="; String cue = "Synonyms:  "; //String that precedes the information we are seeking to use String delimiters = ">,"; String allTheWeb = "http://stage.itp.nyu.edu/icm/proxy/proxy.php?url=http://alltheweb.com/search?cat=img&q="; // using AllTheWeb.com for image search String atwCue = "\"Go= 8){ numberImages = 8; }else { numberImages = synonymArray.length; } images = new eachImage[numberImages]; imageAddressArray = new String[numberImages]; for(int i = 0; i") == -1 && synonymArray[i].indexOf("<") == -1){ imageAddressArray[i] = getImageURL(synonymArray[i]); // imagex = (width/2 + 10 * cos(i*PI/4)); // imagey = (height/2 + 10 * sin(i*PI/4)); // pushMatrix(); rotate(PI/180+(i*8)); translate(250, 250); images[i] = new eachImage(imageAddressArray[i], synonymArray[i], i*8, i*8, i*8); //popMatrix(); counter++; } } returnPressed = true; } else { instrucciones = "Please enter another word. The word you entered returned no results."; typing = ""; text(instrucciones,indent,130); } } else if (key == TAB){ background(0); typing = ""; instrucciones = "Write another word."; text(instrucciones,indent,130); returnPressed = false; } // Otherwise, concatenate the String with what the user pressed on the keyboard else { typing = typing + key; text(typing,indent,90); } } class eachImage{ float xpos; float ypos; float zpos; float wordx; float wordy; int wordx2; int wordy2; int wordz2; String imageURL; String imageWord; PImage yeah; eachImage(String _imageURL, String _imageWord, float _xpos, float _ypos, float _zpos){ imageURL = _imageURL; xpos = _xpos; ypos = _ypos; zpos = _zpos; imageWord = _imageWord; yeah = loadImage("http://stage.itp.nyu.edu/icm/proxy/proxy.php?url="+imageURL); } void mousepress(){ image(yeah, 50, 50); } void render(){ // loadImage(imageURL); tint(255, 132); image(yeah, xpos, ypos); pushMatrix(); translate(60, 60, zpos); rotateY(0.5+rotateInt); rotateZ(int(mouseY/300)); popMatrix(); scale(1.0+float(mouseX/300)); /*for (int i=0; i <65; i++){ stroke(200, 125, 72, 25); beginShape(); vertex(wordx2+i, wordy2+i, wordz2+i); vertex( 100, 100, 100); endShape();}*/ } void type(){ fill(0,0,0); wordx = xpos + 10; wordy = ypos + 10; wordx2 = 350; wordy2 = 50; wordz2 = 25; fill(0,0,0); text(imageWord, wordx, wordy); fill(255); text(imageWord, wordx+1, wordy-1); translate(60, 60, zpos); rotateY(0.5+rotateInt); text(imageWord, wordx2, wordy2, wordz2); } } String getImageURL (String _test){ String atwImageUrl = "Please enter another word. The word you entered returned no results."; _test = _test.trim(); _test = _test.replace(' ', '+'); if (_test != "Please enter another word. The word you entered returned no results."){ // if (_test.indexOf(" ") == 0){ // _test = _test.substring(1, _test.length()); // } String searchString = allTheWeb + _test; try{ String[] atwQuery = loadStrings(searchString); String atwJoin = join(atwQuery, " "); int atwCueStart = atwJoin.indexOf(atwCue); int atwCueEnd = atwCueStart + atwCue.length(); // this is the point in the string where the image url starts int nextQuoteMark = atwJoin.indexOf("\" ", atwCueEnd); // this is where the image url will end atwImageUrl = atwJoin.substring(atwCueEnd, nextQuoteMark); println(atwImageUrl); }catch (Exception e){ System.out.println("RuntimeException: "+e); return "bad"; }//catch (IOException f){ // System.out.println("IOException: "+f); // } } return atwImageUrl; } String[] search(String _textentry){ String[] html = loadStrings(tesauro + _textentry); // gives back URL + searched word in a string array String htmlJoined = join(html, " "); // changes the string array of lines into one big chunk o' text String[] synonymJunkSplit = {"Please enter another word. The word you entered returned no results."}; if ((htmlJoined.indexOf(cue)) != -1){ int start = htmlJoined.indexOf(cue); // cue = "Synonyms:  " int end = start + cue.length(); // this is the point in the string where the synonyms start int nextTD = htmlJoined.indexOf("", end); // this is where the synonyms will end String synonymJunk = htmlJoined.substring(end, nextTD); // returns string of synonyms with span tags possibly mixed in println("synonymJunk = " +synonymJunk); int checkspan = synonymJunk.indexOf("" & "," if (checkspan != -1){ // if there are in fact span tags, then do this... int[] checkspanSplit = new int[synonymJunkSplit.length]; // create array for determining position of "<" String[] checkspanSplit2 = new String[synonymJunkSplit.length]; // create array for 2nd time around of checking for "<" for (int i=0; i -1 && checkspanSplit[i] < 3){ synonymJunkSplit[i] = ""; } else if (checkspanSplit[i] > 2){ checkspanSplit2[i] = synonymJunkSplit[i].substring(0 , checkspanSplit[i]); synonymJunkSplit[i] = checkspanSplit2[i]; synonymJunkSplit[i] += synonymJunkSplit[i+1]; synonymJunkSplit[i+1] = ""; } } } } println(synonymJunkSplit); return synonymJunkSplit; } void mousePressed(){ background(0); for(int i = 0; i