PICO-8 tweetcart.
The blue lines indicate the trajectory of simulated particles as they are pulled by the planets' gravity. If a particle hits a planet (one of the colored outlines) it colors its originating pixel the color of that planet. If a particle doesn't hit a planet within a certain number of steps in the simulation, it colors the originating pixel black.
This tweetcart is inspired by a video about fractal patterns that emerge from gravity simulations:
The full source code for the effect can be viewed below. Run/edit the code in PICO-8 here!
for r=0,8192do x=r%128y=r\128u=0v=0i,o=x,y for k=1,128do for j=0,4do srand(j+9)g=rnd(128)h=rnd(128)q=x-g w=y-h d=((q/4)^2+(w/4)^2)^█*16u-=q/d v-=w/d circ(g,h,2,j+8)if(d<15)sset(i,o,j+8)goto l end line(x,y,x+u,y+v,1)x+=u y+=v end ::l::if(stat(1)>.8)flip() memcpy(24576,0,8192)end
For the sake of performance, I had very few steps in the simulation per pixel, leading to a stripey/paint splatter effect seen in the final result. You can try to change some of the variables to improve the resolution of the simulation!