Export Code

Milkey Way Galaxy

Nita

Last edited Mar 24, 2025
Created on Mar 24, 2025

Milky 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

MIT Licensed