float[] px = new float [13]; float[] py = new float [13]; float[] tw = new float [13]; void setup() { size(1024,640); frameRate(90); String lines[] = loadStrings ("words.txt"); PFont font; font = loadFont ("Stencil-16.vlw"); textFont(font); for (int i=0; i<13; i++) { px[i] = random(20,width-20); py[i] = random(100,height-20); tw[i] = textWidth(lines[i]); } } void draw() { String lines[] = loadStrings ("words.txt"); background(255); PImage b; b = loadImage("title.jpg"); image(b, 0, 0); fill(255,0,50,100); noStroke(); PFont font; font = loadFont ("Stencil-16.vlw"); textFont(font); textAlign (CENTER); for (int i=0; i<13; i++) { text (lines[i], px[i], py[i]); } } void mouseDragged() { for (int i=0; i<13; i++) { float dx= mouseX-px[i]; float dy =mouseY-py[i]; if ((abs(dx) <(tw[i]/2))&& (abs(dy)<10)) { px[i] = mouseX; py[i] = mouseY; } } } void mouseReleased() { String lines[] = loadStrings ("words.txt"); for (int i=0; i<13; i++) { float dx= mouseX-px[i]; float dy =mouseY-py[i]; boolean test1 = (abs(dx) <(tw[i]/2))&& (abs(dy)<10); //boolean test2 != mouseDragged; if (test1&&(mouseButton == RIGHT)) { String filename = "http://senseable.mit.edu/pink/files/" +lines[i] + ".pdf"; link(filename); } } }