Skip to content

Instantly share code, notes, and snippets.

@volfegan
Last active December 28, 2019 03:09
Show Gist options
  • Save volfegan/2977f53ed7f2931d9e971acb1c433650 to your computer and use it in GitHub Desktop.
Save volfegan/2977f53ed7f2931d9e971acb1c433650 to your computer and use it in GitHub Desktop.
Circles in Circles moving creates a perfect spiral
//reference code for solution of perfect Spiral:
//https://gist.github.com/chandeeland/b69156115e2b5842d83ca9eb3b2bbf2e
//failed trial:: https://gist.github.com/volfegan/e55decad6814e63fb450379c9bf13a61
//attempt to recreate: https://twitter.com/Borrachas/status/1204855395006763009
float a, b, x, y, d, h=600/2, r, s, shrink=0.94;
void setup() {
size(600, 600);
}
void draw() {
background(#EFF2D0);
translate(h, h);
for (s=600*2; s>1; s*=shrink) {
d=norm(s, 0, 600*2);
fill(0, (1-d)*20);
strokeWeight(d*15);
r = d*50*shrink;
x=cos((b*d*100*(1-shrink))+a)*r;
y=sin((b*d*100*(1-shrink))+a)*r;
circle(x, y, s);
b+=d;
}
a+=.1;
fill(0);
circle(cos(b+a)*5, 0, 40);
b=0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment