int maxSpawnPoints = 30; int mouseAwareness = 50; int pulseRate = 200; color randomColor; Particles[] fountain = new Particles[maxSpawnPoints]; int mousePosX, mousePosY; int oldMousePosX, oldMousePosY; int notMoved; boolean mouseWithin; class Particles { int[] posX = new int[height]; color[] individualColor = new color[height]; Particles(int Y, color setColor) { for (int y=0; y= mousePosX-mouseAwareness) && (y <= mousePosY+mouseAwareness) && (y > mousePosY)) { if (this.posX[y] < mousePosX) { this.posX[y]=this.posX[y+1]-1; } else if (this.posX[y] > mousePosX) { this.posX[y]=this.posX[y+1]+1; } else if (this.posX[y] == mousePosX) { if (random(0,1)==0) { this.posX[y]=this.posX[y+1]+1; } else { this.posX[y]=this.posX[y+1]-1; } } } else { this.posX[y] = this.posX[y+1]+int(random(-2,2)); } } /* gives a new value for the lowest height. offset by -1,0, or 1 (non-inclusive) */ this.posX[height-1] = this.posX[height-1]+int(random(-2,2)); } void display() { for (int y=0; y 1)) { mouseAwareness--; println("DOWN: Changed mouseAwareness to: "+mouseAwareness); } keyPressed = false; mouseDraw(); } } void draw() { fill(0,0,0,10); rect(0,0,width,height); mouseWithin = ((0 < mousePosY) && (0 < mousePosX) && (mousePosY < height) && (mousePosX < width)); for (int a=0; a