import krister.Ess.*; Point[] p; float a[][][]; int num; float[][] currentPos; float xoff = 0; float xincr = .01; int startingShape = 0; PImage grime; void setup () { frameRate(30); size(650, 500); soundStart(); grime = loadImage("screen.tga"); buildShapeArray(); currentPos = new float[num][2]; p = new Point[num]; for (int n=0; n < num; n++) { p[n] = new Point (a[startingShape][n][0], a[startingShape][n][1]); } } int t; void draw () { makeBackground(); makeFace(); modSound(); addScreen(); xoff+=xincr; t++; } class Point { float x, y; int futureShape; int s[][][]; Point(float ex, float yi) { x = ex; y = yi; futureShape = 1; } void getCoord ( int pn ) { float xf = a[futureShape][pn][0]; float yf = a[futureShape][pn][1]; float dx = xf-x; float dy = yf-y; float ang = atan2(dx,dy); float stepSize = random(0,5); float xn = stepSize*(cos(ang)); float yn = stepSize*(sin(ang)); if (dx != 0 && dy != 0) { if (abs(dx)/dx == abs(dy)/dy) { x += xn + random(-2,2); y += yn + random(-2,2); } else { x-=xn + random(-2,2); y-=yn + random(-2,2); } } float threshold = .1; if (dx < threshold && dy < threshold) { futureShape = int(random(0,2)); } } void setVert (int n) { //x += random(-2,2); //y += random(-2,2); currentPos[n][0] = x; currentPos[n][1] = y; } }