This project visualizes a simplified simulation of the 3-body problem using HTML, JavaScript, and the Canvas API. The simulation allows users to interactively adjust the masses of three celestial bodies and observe their gravitational interactions in real-time.
- Interactive Mass Adjustment: Adjust the masses of the three bodies using sliders before starting the simulation.
- Collision Handling: Bodies may collide and merge based on their masses.
- Real-Time Rendering: Bodies leave trails that visualize their paths over time.
- Drag and Drop: Adjust the initial positions of the bodies by dragging them on the canvas before starting the simulation.
- Clone or download the project files.
- Open
index.html
in a web browser to start the simulation.
- index.html: Main HTML file that sets up the structure.
- main.js: Contains the logic for the 3-body simulation, including physics calculations and rendering.
- styles.css: Styles for the UI elements and canvas.
- Adjust the masses of the bodies using the sliders in the pop-up window.
- Click the Start button to begin the simulation.
- Drag the bodies to change their initial positions before starting.
- The simulation centers on the heaviest body for better visualization.
- HTML, CSS, JavaScript
- Canvas API for rendering the simulation