Skip to content

Instantly share code, notes, and snippets.

@chandeeland
Created December 17, 2019 23:34
Show Gist options
  • Save chandeeland/b69156115e2b5842d83ca9eb3b2bbf2e to your computer and use it in GitHub Desktop.
Save chandeeland/b69156115e2b5842d83ca9eb3b2bbf2e to your computer and use it in GitHub Desktop.
Circles in Circles moving to give the illusion of spirals (processing v3)
// inspired by https://gist.github.com/volfegan/e55decad6814e63fb450379c9bf13a61
// attempt to recreate: https://twitter.com/Borrachas/status/1204855395006763009
float a=0, b=0, x,y;
float shrink, spin_speed;
void setup() {
size(800,800);
shrink = 0.900;
spin_speed = 0.1;
}
void draw() {
float d;
background(#FF0405);
translate(400,400);
for (float diameter=1600; diameter > 1; diameter*=shrink) {
d = norm(diameter, 0, 1600);
strokeWeight(d * 25);
fill(0,(1-d)*20);
float inner_radius = d*100*shrink;
x = cos((b*d*100*(1-shrink))+a) * inner_radius;
y = sin((d*b*100*(1-shrink))+a) * inner_radius;
circle(x,y, diameter);
b += d;
}
b = 0;
a += spin_speed;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment