Skip to content

Instantly share code, notes, and snippets.

@volfegan
Last active June 26, 2020 22:58
Show Gist options
  • Save volfegan/01db60ede4c1c02ebec62ce8a38d1582 to your computer and use it in GitHub Desktop.
Save volfegan/01db60ede4c1c02ebec62ce8a38d1582 to your computer and use it in GitHub Desktop.
Mimics a probe leaving the orbit of a Star
//inspired by https://www.dwitter.net/d/10739
//https://twitter.com/VolfeganGeist/status/1276374673396322304
float i, c, s, t=255, x, y, R, T;
void setup() {
size(1080, 720);
stroke(t, t, 0);
}
void draw() {
clear();
translate(560, 360);
rotate(t/50);
t-=.01;
for (i=2e3; i>0; i--) {
c=t/3*(i%t<t/8 ? 1 : 0);
R=pow(i, .7);
T=pow(i, .5);
x=c*sin(R)+t*cos(T);
y=c*cos(R)+t*sin(T)*cos((c==0 ? 1 : 0) *i);
s=8*sin(i*160-2*t);
square(x, y, s);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment