Log In  


Cart #gturtle_gravity_fractal_twt-0 | 2024-08-30 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
2

Tweetcart- all source code is 280 characters or less.

Edit in Education edition here!

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:

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!

2



[Please log in to post a comment]