Processing Forum
THANK YOU!
PVector[] positions;int maxpositions = 100;int currentposition = 0;
//boolean right == false;//boolean left == false;
void setup(){size(800, 600);
positions = new PVector[maxpositions];}
void draw(){background (255);
positions[currentposition] = new PVector(mouseX, mouseY);
currentposition++;
if (currentposition >= 99){// shuffle everything downfor (int i = 1; i < currentposition; i++){positions[i-1] = positions[i];}
// stay at 99currentposition = maxpositions - 1;}
for (int i = 0; i < currentposition; i++){ellipse (positions[i].x, positions[i].y, 5, 5);
int sum = 0;sum += positions[i].x;if (i==(maxpositions-2)) {int avgSum;avgSum = sum/maxpositions;float xval;xval = (avgSum-positions[i-94].x);// println ("average sum of array values = " + avgSum);if (xval>0) {background(0);}if (xval<0) {background(255);}}
}}