Code

linepoints[] lines = new linepoints[10];
float speed = .6;
float bounce = .9;

void setup(){
  size(400,400);
  framerate(30);
  smooth();
  for(int i=0;i<lines.length;i++){
    lines[i] = new linepoints(-10*i,10*i,-lines.length*30/2+i*30,-lines.length*60/2+i*20);
  }
}

void loop(){
  background(255);
  for(int i=0;i<lines.length;i++){
    lines[i].update();
  }
}

class linepoints{
  float ltx,lty,lax,lay,lvx,lvy,lx,ly,ltx2,lty2,lax2,lay2,lvx2,lvy2,lx2,ly2,xoffset,yoffset,xoffset2,yoffset2;
  linepoints(float xo,float yo,float xo2,float yo2){
    xoffset = xo;
    yoffset = yo;
    xoffset2 = xo2;
    yoffset2 = yo2;
  }
  void update(){
    //first endpoint
    ltx = constrain(mouseX+xoffset,0,width);
    lty = constrain(mouseY+yoffset,0,height);
    lax = (ltx-lx)*bounce;
    lay = (lty-ly)*bounce;
    lvx += lax;
    lvy += lay;
    lvx *= speed;
    lvy *= speed;
    lx += lvx;
    ly += lvy;
    //second endpoint
    ltx2 = constrain(lx+xoffset2,0,width);
    lty2 = constrain(ly+yoffset2,0,height);
    lax2 = (ltx2-lx2)*bounce;
    lay2 = (lty2-ly2)*bounce;
    lvx2 += lax2;
    lvy2 += lay2;
    lvx2 *= speed;
    lvy2 *= speed;
    lx2 += lvx2;
    ly2 += lvy2;
    line(lx,ly,lx2,ly2);
  }
}

void keyPressed(){
  if(key=='s'){
    save("tenlines.tif");
  }
}

007 -- Interaction and Iteration: Ten Lines

Statement:Develop a composition which in which ten straight lines respond to the cursor.


a little elasticity... i think i like curves made of lines... you can squish it against the edges of the screen

hide statement