Milkey Way Galaxy
A Canvas-based animation depicts the Milky Way as a glowing, rotating spiral of ten thousand stars. Logarithmic spiral arms, colored dust lanes, and semi-transparent nebulae are rendered with radial gradients and individual `ctx.arc` calls. Star colors vary by position, with a yellowish core and bluish young stars, while `requestAnimationFrame` drives smooth, Keplerian rotation where inner regions orbit faster.
AI-generated descriptionMilky Way Galaxy Visualization
This project creates an interactive visualization of the Milky Way galaxy using HTML Canvas and JavaScript. The visualization features:
- Thousands of stars distributed in a spiral galaxy pattern
- Multiple spiral arms with distinct structures
- A bright galactic core
- Colored dust lanes and nebulae
- Realistic rotation with inner regions rotating faster (Keplerian rotation)
- Different star colors representing various star types
- Responsive design that adapts to different screen sizes
How to Use
Simply open the index.html file in a modern web browser to view the galaxy. No interaction is required, but the visualization will automatically adjust if you resize your browser window.
Implementation Details
The galaxy is rendered on an HTML Canvas element with these key features:
Star generation with varying colors based on position in the galaxy:
- Yellowish stars in the core
- Bluish young stars in selected spiral arms
- General yellowish-white stars throughout
Dust lanes that create darker regions in the spiral arms
Nebulae rendered as colorful, semi-transparent clouds:
- Reddish emission nebulae
- Bluish reflection nebulae
- Yellowish star-forming regions
Realistic spiral structure with logarithmic spirals
Animation uses requestAnimationFrame for smooth performance