Skip to content

Instantly share code, notes, and snippets.

@disser2
Last active December 15, 2015 15:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save disser2/5284244 to your computer and use it in GitHub Desktop.
Save disser2/5284244 to your computer and use it in GitHub Desktop.
Lines follow you everywhere!
void setup() {
size(500, 500);
}
int lineLength = 20;
int interval = 25;
int resolution = 10;
int blue = 0;
int border = 300;
void draw() {
fill(100);
rect(0, 0, width, height);
//Colors
noStroke();
for (int i = 0; i < border; i = i + resolution)
{
for (int j = 0; j < border; j = j + resolution)
{
fill(i, j, blue);
rect(i, j, i+resolution, j+resolution);
}
}
//Lines
stroke(0);
for (int i = 0; i <= width; i = i + interval) {
for (int j = 0; j <= height; j = j + interval) {
float angle = atan2(mouseY-j, mouseX-i);
line(i, j, i+lineLength*cos(angle), j+lineLength*sin(angle));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment