This application simulates the effects of gravity from different planets on a bouncing ball. It provides a visual representation of how objects would behave under different gravitational conditions.
- Simulate gravity effects from different planets (Earth, Moon, Mars, Venus, Mercury, and Jupiter)
- Interactive bouncing ball simulation
- Real-time planet selection
- Reset functionality
- Realistic physics simulation with elasticity
- Go 1.21 or later
- Fyne toolkit dependencies
- Clone the repository:
git clone https://github.com/alandavd/graty.git
cd graty
- Install dependencies:
go mod tidy
- Run the application:
go run main.go
- Launch the application
- Select a planet from the dropdown menu to change the gravity simulation
- Watch the ball bounce with the selected planet's gravity
- Use the "Reset Ball" button to return the ball to its initial position
The simulation uses basic physics equations for gravity and elastic collisions:
- Gravity acceleration is applied continuously to the ball
- Elastic collisions are simulated with a coefficient of elasticity (0.7)
- Time-step based animation at ~60 FPS
- Earth: 9.81 m/s²
- Moon: 1.62 m/s²
- Mars: 3.72 m/s²
- Venus: 8.87 m/s²
- Mercury: 3.7 m/s²
- Jupiter: 24.79 m/s²