Last active
December 15, 2015 15:49
-
-
Save disser2/5284244 to your computer and use it in GitHub Desktop.
Lines follow you everywhere!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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