Skip to content

Instantly share code, notes, and snippets.

@fkaa
Created May 6, 2017 11:54
Show Gist options
  • Save fkaa/6f5a8668af027840b3b374b8ef47dbd0 to your computer and use it in GitHub Desktop.
Save fkaa/6f5a8668af027840b3b374b8ef47dbd0 to your computer and use it in GitHub Desktop.
float increment = 0.009;
float yy = 0;
void setup() {
size(640, 360);
}
int checkerboard(int x, int y) {
if ((x + y & 1) == 0) {
return color(74, 104, 139, 255);
} else {
return color(253, 216, 215, 255);
}
}
void draw() {
yy += 0.1;
loadPixels();
float xoff = 0.0;
float detail = map(mouseX, 0, width, 0.1, 0.6);
noiseDetail(8, detail);
for (int x = 0; x < width; x++) {
xoff += increment;
float yoff = 0.0;
for (int y = 0; y < height; y++) {
yoff += increment;
float r = (noise(xoff, yy+yoff) * 2 - 1) * 32 * (y / 360.0);
float g = (noise(xoff+123123, yy+yoff+4342) * 2 - 1) * 32 * (y / 360.0);
pixels[x+y*width] = checkerboard((x + (int)r) / (640 / 8), (y + (int)g) / (360 / 8));
}
}
updatePixels();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment