/** * Follow 3 * based on code from Keith Peters. * * A segmented line follows the mouse. The relative angle from * each segment to the next is calculated with atan2() and the * position of the next is calculated with sin() and cos(). */ float[] x = new float[20]; float[] y = new float[20]; float segLength = 18; void setup() { size(640, 360); strokeWeight(9); stroke(255, 100); } void draw() { background(0); dragSegment(0, mouseX, mouseY); for(int i=0; i