Galaxy Generator

Procedural Generation
This build is all about particles and creating patterned randomness rather than just throwing dots on the screen. It is a solid exercise in using pure logic to drive front-end visuals.
The Math Behind the Spiral
To get the shape right, I used Math.cos() and Math.sin() to calculate the specific angles, bending straight lines into curved spiral arms. To make it look organic, I applied power functions to scatter the particles naturally, keeping them densely packed at the core and widely dispersed at the edges.
Color Interpolation
For the coloring, I used linear interpolation (lerp). This math function smoothly blends the hot inside colors with the cooler outside colors depending on how far a particle is from the center.
Interactive Controls
I wired up a control panel in the top right corner so the scene is completely interactive. You can tweak the particle count, branch angles, colors, and randomness to generate a totally different galaxy, so go ahead and mess around with the settings.