Connectors l1; float radius = 30; float[] x = new float[]; float[] y = new float[]; float[] d = new float[]; HashMap losImage = new HashMap(); int maxSize = 80; int minSize = 60; float [][] e = new float [theData.length][5]; float ds = 2; int sel = 0; int change = 0; int num = 0; String[] likesList = new String[]; float[] textLength = new float[5]; float[] xpos = new float[5]; float spring = 0.05; boolean dragging = false; void mouseDragged(){ dragging = true; } void mouseReleased(){ dragging = false; } void setup(){ size(screen.width, screen.height); frameRate(25); smooth(); strokeWeight(2); for (int i = 0; i width-diam)||(e[j][0] < diam)){ e[j][3] = e[j][3]*-1; } if((e[j][1] > height-diam)||(e[j][1] < diam)){ e[j][4] = e[j][4]*-1; } for (int i = j+1; i < theData.length; i++){ float dx = e[i][0] - e[j][0]; float dy = e[i][1] - e[j][1]; float distance = sqrt(dx*dx + dy*dy); float minDist = e[i][2] + diam; //println(minDist); if (distance < minDist) { float angle = atan2(dy, dx); float targetX = e[j][0] + cos(angle) * minDist; float targetY = e[j][1] + sin(angle) * minDist; float ax = (targetX - e[i][0]) * spring; float ay = (targetY - e[i][1]) * spring; e[j][3] -= ax; e[j][4] -= ay; e[i][3] += ax; e[i][4] += ay; } } //ellipse(e[j][0], e[j][1], radi, radi); //move circle e[j][2] = radi + random(sin( frameCount / 4 )); e[j][0]+=e[j][3]; e[j][1]+=e[j][4]; x[j] = e[j][0]; y[j] = e[j][1]; d[j] = e[j][2]; } }