A browser-based projectile motion simulator built with p5.js. Set a launch speed, angle, and gravitational acceleration to watch a ball follow its trajectory, then view the calculated range, time of flight, and maximum height.
- Adjustable launch speed (m/s) and angle (°)
- Selectable gravitational acceleration: 9.8, 9.81, or 10 m/s²
- Live preview line showing the launch angle before firing
- Animated trajectory with trailing path
- Results panel showing:
- Time of flight
- Range of the projectile
- Maximum height reached
- Reset button to reload and try again
Open index.html in a browser, or serve the folder with any static file server.
- Clone or download this repository.
- Open
index.htmldirectly in a web browser (double-click, or right-click → Open With). - Enter a speed and angle in the input boxes.
- Choose a gravity value (9.8, 9.81, or 10).
- Click Start to launch the projectile.
- Click Reset to clear the simulation and try again.
No installation is required — the project relies on the p5.js library loaded via CDN.
Projectile-Motion-Simulator-main/
├── index.html # Page structure and styling
├── setup.js # p5.js setup, UI elements, and gravity controls
├── sketch.js # Main draw loop, Ball class, and physics calculations
├── app.js # Helper functions for UI button states
└── images/
└── bg.jpg # Background image