How pedrogabe/gravity works
This is a small browser-based gravity sandbox: users create and launch circular bodies, adjust their properties and gravity, and watch the bodies interact on a canvas. The runtime is concentrated in two scripts; the graph separates input, simulation, and rendering responsibilities that share state. The README is empty, so capabilities and relationships are based on the shown source excerpts.
Main entry points: sketch.js Body state · script.js Settings controls
Components 7
Controls
- Settings controls
script.js
Simulation
- Body creation
sketch.js - Body state
sketch.js - Gravity physics
sketch.js - Canvas rendering
sketch.js
Other components
- User
- p5 canvas runtime
Connections 9
- User → Settings controls: adjusts settings
script.js - Settings controls → Body state: updates parameters
script.js - User → Body creation: drags to launch
sketch.js - Body creation → Body state: adds body
sketch.js - Body state → Gravity physics: calculates attraction
sketch.js - Gravity physics → Body state: updates velocity
sketch.js - Body state → Canvas rendering: draws bodies
sketch.js - Canvas rendering → p5 canvas runtime: renders frame
sketch.js - Body creation → p5 canvas runtime: checks canvas input
sketch.js