Hey! 👋
This is a simple Python script that creates a cool spiral galaxy animation using matplotlib and numpy. You’ll see thousands of stars spinning around, kinda like what you’d imagine a galaxy looks like from space.
- Generates 3000 stars with random positions and colors
- Arranges them in spiral arms (like a real galaxy)
- Animates the stars so they rotate around the center
- Shows a bright yellow core in the middle
-
Make sure you have Python installed (I used Python 3.12, but anything recent should work).
-
You’ll need matplotlib and numpy. If you don’t have them, just run this in your terminal:
pip install matplotlib numpy -
Run the script:
python galaxy.py -
The animation window should pop up. If it doesn’t, check your Python and matplotlib install.
I just thought galaxies are awesome and wanted to see if I could make one with code. It’s also a fun way to mess around with numpy and matplotlib animations.
Yeah, go for it! Tweak the numbers, change the colors, make it your own. If you make something cooler, let me know 😄