Created
May 2, 2020 01:23
-
-
Save nmcb/442e1e77e23ca71eab964163a624092e to your computer and use it in GitHub Desktop.
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
//by Jo | |
//https://twitter.com/jn3008/status/1169671889121435656 | |
// opensimplexnoise code in another tab is necessary | |
// --> code here : https://gist.github.com/Bleuje/fce86ef35b66c4a2b6a469b27163591e | |
void setup() { | |
size(800, 600, P2D); | |
smooth(8); | |
noFill(); | |
strokeWeight(2); | |
stroke(255); | |
noise = new OpenSimplexNoise(); | |
} | |
OpenSimplexNoise noise; | |
float t, radius = 300, noise_radius = 1.8; | |
int nj = 24, ni = 120; | |
void draw() { | |
t += 0.005; | |
t%=1; | |
translate(width*0.5, height* 0.5); | |
background(0); | |
for (int j = 0; j <= nj; j++) { | |
for (int i = 0; i < ni; i++) { | |
float th = TAU*i/ni; | |
PVector posShape = new PVector(map(j, 0, nj, 1, 0.3), 0).rotate(th); | |
float ph = TAU*(i*1.0/ni+j*0.5/nj+t); | |
//position in noise planes, on the surface of a torus | |
PVector posNoise = new PVector(noise_radius*(1+cos(ph)), 0, noise_radius*sin(ph)).rotate(th); | |
posShape.mult(radius*0.8 + radius*0.15*(float)noise.eval(posNoise.x, posNoise.y, posNoise.z, 0.8*sin(posNoise.heading()))); | |
point(posShape.x, posShape.y); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment