Skip to content

Instantly share code, notes, and snippets.

@volfegan
Last active June 29, 2020 17:38
Show Gist options
  • Save volfegan/cf99fa5584c34e98dce0ffb6505aa70d to your computer and use it in GitHub Desktop.
Save volfegan/cf99fa5584c34e98dce0ffb6505aa70d to your computer and use it in GitHub Desktop.
Mimics a probe approaching Saturn like planet
//inspired by https://www.dwitter.net/d/10534
//https://twitter.com/VolfeganGeist/status/1273451476556353536
float i, m, n, p, s, t, x, y;
void setup() {
size(1080, 720);
noStroke();
}
void draw() {
background(0);
t+=.05;
for (i=2e3; i>0; i--) {
p=i%2==0 ? 0 : 1;
m=t/cos(t/i)+p*(t/2+i%t);
n=t/9+i*i;
x=560+m*sin(n)*cos((p==0 ? 1 : 0)*i/t);
y=360+m*cos(n+p*2);
s=3-cos(n)*3;
rect(x, y, s, s);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment