// Dynamic Acceleration: PVector // Daniel Shiffman // The Nature of Code, Spring 2009 // Demonstrates a dynamically changing acceleration (towards the mouse) // Declare a "Thing" object Thing[] t; int z = 0; int timer = 0; int rand = 1; int k = 0; PVector a ; PVector v ; PVector l ; PVector prev = new PVector(0,0); int mouseTrack = 0; int[] prevMo = new int[4]; void setup() { size(700,400); smooth(); t = new Thing[200]; // Create the thing object } void draw() { prevMo[mouseTrack] = mouseX; mouseTrack++; prevMo[mouseTrack] = mouseY; mouseTrack++; if (mouseTrack == 4){ mouseTrack = 0; } background(0); a = new PVector(0.0,random(0,0.1)); v = new PVector(0.0,0.0); l = new PVector(random(0,width),0-10); t[z] = new Thing(a,v,l); for(int i = 0; i