// Classes.pde (part of Perly Burly) // Dave Bollinger, Dec 2006 // http://www.davebollinger.com // for Processing 0123 Beta class Particle { float x, y, vx, vy; float r, g, b, a, da; Particle() { } void create() { x = random(-1f,1f); y = random(-1f,1f); vx = vy = 0f; color c = pal.get(); r = red(c); g = green(c); b = blue(c); a = random(0.9f,1.0f); da = random(0.005f,0.02f); } void draw() { noisefield.apply(this); a -= da; x += vx; y += vy; if ((x<-1f) || (y<-1f) || (x>1f) || (y>1f) || (a<0f)) create(); color c = color(r, g, b, (1f-a*a)*64f); plot(ctrx+x*ctrx, ctry+y*ctry, c); } } class NoiseField { float [] noisezx; float [] noisezy; float [] noisescale; float [] rates; float squeeze; float friction; int nfields; NoiseField(int nf) { noiseDetail(3); nfields = nf; noisezx = new float[nfields]; noisezy = new float[nfields]; noisescale = new float[nfields]; rates = new float[nfields]; create(); } void create() { for (int i=0; i