Skip to content

Instantly share code, notes, and snippets.

@Bleuje
Last active January 23, 2021 09:47
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Bleuje/85caf5a0324b6b5e717f1b26182cd758 to your computer and use it in GitHub Desktop.
Save Bleuje/85caf5a0324b6b5e717f1b26182cd758 to your computer and use it in GitHub Desktop.
OpenSimplexNoise noise;
void setup(){
size(500,500);
noise = new OpenSimplexNoise();
}
int spacing = 15;
int numFrames = 100;
float R = 0.5;
float scale = 0.01;
void draw(){
float t = (1.0*frameCount/numFrames)%1;
background(0);
stroke(255);
for(int x = 0;x<width;x+=spacing){
for(int y = 0;y<height;y+=spacing){
float ns = (float)noise.eval(scale*x,scale*y,R*cos(TWO_PI*t),R*sin(TWO_PI*t));
if(ns<0){
line(x,y,x+spacing,y+spacing);
} else {
line(x,y+spacing,x+spacing,y);
}
}
}
if(frameCount<=numFrames){
saveFrame("fr###.png");
}
if(frameCount==numFrames){
println("finished");
//stop();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment