Skip to content

Instantly share code, notes, and snippets.

@mfep
Created October 1, 2019 19:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mfep/2239abee4efd193abcbdf005bd0d0848 to your computer and use it in GitHub Desktop.
Save mfep/2239abee4efd193abcbdf005bd0d0848 to your computer and use it in GitHub Desktop.
Modulated fibonacci sequence visualization in Processing
float turnFraction = (1 + sqrt(5))/2;
int numPoints = 3000;
void setup()
{
size(1000, 1000);
noStroke();
fill(255);
frameRate(30);
}
void draw()
{
turnFraction = sin(millis() / 1000000.0f);
float coloring = cos(millis()/3333.3f);
background(127 - coloring * 127);
fill(127 + coloring * 127);
pushMatrix();
translate(500, 500);
for(int i = 0; i < numPoints; ++i)
{
float dst = pow(i / (numPoints - 1f), sin(millis()/5000.0f)) * 256 - 256 * sin(millis() / 10000.0f);
float angle = TWO_PI * turnFraction * i;
float x = dst * cos(angle);
float y = dst * sin(angle);
circle(x, y, 3 - 1.5 * coloring);
}
popMatrix();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment