Created
October 1, 2019 19:15
-
-
Save mfep/2239abee4efd193abcbdf005bd0d0848 to your computer and use it in GitHub Desktop.
Modulated fibonacci sequence visualization in Processing
This file contains 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 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