Thousand Lines
My idea of thousand lines came from my friends homework where it was some sort of magnetic field/graph. So I thought of it as a way to make the one thousand line assignment since the lines could react to the mouse by staying still but just moving the direction of the lines instead of following the whole thing like my first two line assignments.
float spaceBetween;
float columns;
float rows;
PVector mousePosition;
void setup() {
size(480,480);
spaceBetween = 15;
columns = int(width/spaceBetween);
rows = int(height/spaceBetween);
}
void draw() {
background(201,240,242);
mousePosition = new PVector(mouseX,mouseY);
stroke(49,196,175);
for(int i = 0; i <= columns; i++){
for(int j = 0; j <= rows; j++){
drawLines(i*spaceBetween, j*spaceBetween);
}
}
}
void drawLines(float x, float y) {
PVector pos = new PVector(x,y);
point(pos.x,pos.y);
stroke(49,196,175);
PVector lineTarget = new PVector(mouseX, mouseY);
lineTarget.sub(pos);
lineTarget.mult(-1);
pushMatrix();
translate(pos.x,pos.y);
lineTarget.normalize();
lineTarget.mult(10);
line(0,0, lineTarget.x,lineTarget.y);
popMatrix();
}