Last active
December 17, 2015 08:59
-
-
Save tai2/5584187 to your computer and use it in GitHub Desktop.
polar noise
This file contains hidden or 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
| 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