Skip to content

Instantly share code, notes, and snippets.

@tai2
Last active December 17, 2015 08:59
Show Gist options
  • Select an option

  • Save tai2/5584187 to your computer and use it in GitHub Desktop.

Select an option

Save tai2/5584187 to your computer and use it in GitHub Desktop.
polar noise
float dnoise = 0;
void setup() {
size(300, 300);
frameRate(30);
}
void draw() {
background(0);
float ynoise = 0;
for (int y = 0; y < height; y++) {
ynoise += 0.01;
float xnoise = 0;
for (int x = 0; x < width; x++) {
xnoise += 0.01;
int tx = x - width / 2;
int ty = y - height / 2;
float d = sqrt(tx * tx + ty * ty) / width;
float t = 0 <= ty ? acos(tx / d) : 2 * PI - acos(tx / d);
set(x, y, color(255 * noise(xnoise, ynoise, dnoise + 20 * d * d)));
}
}
dnoise += 0.03;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment