//import processing.opengl.*; /*This is based on the Bouncy Bubbles from Keith Peters (www.bit-101.com). I've added the ability to use WordPress tags to size the bubbles and link to the url of the tags*/ int numBalls=25; float spring = 0.02; float gravity = -0.03; float friction = -0.9; ball[] balls = new ball[numBalls]; int recordCount; record[] records; String[] lines; PFont body; int num = 45; // Display this many entries on each screen. int startingEntry = 0; // Display from this entry number int originPoint; boolean leftClicked=false; void setup() { size(1240, 800, P2D); fill(255,50,50,50); smooth(); body = loadFont("Georgia-64.vlw"); textFont(body); float origin=random(0,numBalls); originPoint=int(origin); lines = loadStrings("http://www.bryanleister.com/test.txt"); records = new record[lines.length]; for (int i = 0; i < lines.length; i++) { String[] pieces = split(lines[i], "'"); // Load data into array if (pieces.length >= 8) { records[recordCount] = new record(pieces); recordCount++; } } for (int i= 0; i < numBalls; i++) { int thisEntry = startingEntry + i; String n=records[thisEntry].name.replace(">",""); n=n.replace(" width) { x = width - diameter/2; vx *= friction; } else if (x - diameter/2 < 0) { x = diameter/2; vx *= friction; } if (y + diameter/2 > height) { y = height - diameter/2; vy *= friction; } else if (y - diameter/2 < 0) { y = diameter/2; vy *= friction; } } void display() { noStroke(); fill(255,50,50,150); stroke(255,150,150,50); if(x>=1000){x=0;} ellipse(x, y, diameter, diameter); fill(50,50,50,20); line(x,y,others[originPoint].x,others[originPoint].y); //println(others[id].x); //scale(diameter); textSize(diameter); if(dist(mouseX,mouseY, x,y)<20){ x=mouseX; y=mouseY; vx=0; vy=0; fill(100,100,100,100); text(ballname, x-diameter, y+diameter); if(mousePressed==true && leftClicked==true){ link(ballurl); leftClicked=false; } } //text(ballname, x-diameter, y+diameter); } } void mousePressed() { if(mouseButton==LEFT) { leftClicked=true; } } void mouseReleased() { if(mouseButton==LEFT) { leftClicked=false; } }