Code

//Leonardo Covarrubias
//Exercise013
//
//trail of lines follow the mouse, lines are perpendicular to most recent mouse vector, and equal to the vector length

int mousex1 = mouseX;
int mousey1 = mouseY;
int mousex2;
int mousey2;

Line [] lineArray = new Line[100];

void setup(){
  size(400, 400);
  strokeWeight(3);
  
  background(0);
}


void draw(){
  background(0);
  stroke(255);
  framerate(20);
  smooth();
  
  mousex2 = mousex1;
  mousey2 = mousey1;
  
  mousex1 = mouseX;
  mousey1 = mouseY;
  
  //Fills the array if empty
  if(lineArray[1] == null){
    for(int i = 0; i < 10; i++){
      lineArray[i] = new Line(mousey1, mousex1, mousey2, mousex2);
    }
  }
  
  //shifts lines in the array
  for(int i = 99; i > 0; i--){
    lineArray[i] = lineArray[i-1];
  }
  
  //adds a new line at array 0
  lineArray[0] = new Line(mousex1-(mousey1-mousey2), mousey1+(mousex1-mousex2), mousex1+(mousey1-mousey2), mousey1-(mousex1-mousex2));
  
  //draws the lines from the array
  for(int i = 0; i < 100; i++){
    if(lineArray[i] == null){
      break;
    }
    lineArray[i].drawLine();
  }


  
}

//defines a Line
class Line {
  
  int x1,y1,x2,y2;
  
  Line(int x,int y,int X,int Y){
    
    x1 = x;
    y1 = y;
    x2 = X;
    y2 = Y;
  
  }
  
  void drawLine(){
    line(x1,y1,x2,y2);
  }
}

013 -- 100 Lines: Iteration & Interaction

Statement:Develop a composition in which one hundred (straight) lines respond to the position and/or movements of the cursor.

Restrictions:
The composition should be 400x400 pixels.
The only allowable colors are black and white (no grays).
lines follow the cursor. they are as long and perpendicular to the last mouse vector

hide statement