Skip to content

Instantly share code, notes, and snippets.

@rlieberman
Created September 24, 2014 12:21
Show Gist options
  • Save rlieberman/803176703cd03747ede6 to your computer and use it in GitHub Desktop.
Save rlieberman/803176703cd03747ede6 to your computer and use it in GitHub Desktop.
void setup () {
size (500, 500);
}
void draw () {
background (0);
float x = 0;
float y = 0;
float spacing = 20;
noStroke ();
float d = dist(width/2, height/2, mouseX, mouseY);
float maxDist = dist(0, 0, width/2, height/2);
colorMode(HSB);
for (x = 0; x < width; x = x + spacing) {
for (y = 0; y < height; y = y + spacing) {
fill (random(d,255), 0, random(d,255));
// fill (random(mouseX/2,250));
rect (x, y, spacing, spacing);
}
}
}
//what about making this grid but adjusting the colors based on where you move the mouse
//use distance () function -- takes 4 arguments: x,y of one point and x,y of another point and it gives you the distance
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment