Code
float[] xlines = new float[50];
float[] ylines = new float[50];
void setup(){
size(400,400);
framerate(20);
smooth();
}
float bounce = .8;
float speed = .7;
float ltx,lty,lax,lay,lvx,lvy,lx,ly;
float r,ar,vr,angle;
boolean paused = false;
void loop(){
background(255);
if(!paused){
angle = atan2(mouseX-pmouseX,mouseY-pmouseY);
}
ar = (angle-r)*bounce;
vr += ar;
vr *= speed;
r += vr;
translate(mouseX,mouseY);
rotate(r);
for(int i=xlines.length-1;i>0;i--){
xlines[i] = xlines[i-1];
//strokeWeight(5*(100-i)/100);
stroke(i*5);
line(xlines[i]-mouseX,-height*2,xlines[i]-mouseX,height*2);
}
for(int i=ylines.length-1;i>0;i--){
ylines[i] = ylines[i-1];
//strokeWeight(ceil(5-(i/ylines.length)*5));
stroke(i*5);
line(-width*2,ylines[i]-mouseY,width*2,ylines[i]-mouseY);
}
rotate(-r);
ltx = constrain(mouseX,0,width);
lty = constrain(mouseY,0,height);
lax = (ltx-lx)*bounce;
lay = (lty-ly)*bounce;
lvx += lax;
lvy += lay;
lvx *= speed;
lvy *= speed;
lx += lvx;
ly += lvy;
xlines[0] = lx;
ylines[0] = ly;
}
void keyPressed(){
if(key=='s'){
save("hundredlines.tif");
}
}
void mousePressed(){
if(paused){
paused = false;
}else{
paused = true;
}
}
008 -- Interaction and Iteration: 100 Lines
Statement:Develop a composition which in which one hundred lines respond to the cursor.
this one's pretty shitty... just playing with the built in transformation matrices