This project is a simulation of a particle system with gravitational forces, visualized in a web browser using WebGL. The simulation includes a set of particles that move according to gravitational forces, as well as user interface controls for adjusting various properties of the simulation such as particle velocity, lifespan, and the appearance of the particles and field. The program also includes a feature to draw black holes that repel particles away from their center. The code is structured using JavaScript and several libraries such as MV.js for vector operations and a set of utility functions for working with WebGL.
To use the application tool, follow these steps:
Key | Action |
---|---|
Shift + Mouse Move |
Hold down Shift and drag the Mouse to set new origin when clicked |
Mouse click + Mouse Move |
Click the Mouse to create a planet center, drag to the side and release to make it permanent in the field |
PageUp | Increase maximum velocity or minimum velocity of the particles |
PageDown | Decrease maximum velocity or minimum velocity of the particles |
ArrowUp | Decrease beam angle |
ArrowDown | Increase beam angle |
ArrowLeft | Increase beam opening |
ArrowRight | Decrease beam opening |
q | Increase minimum life of particles |
a | Decrease minimum life of particles |
w | Increase maximum life of particles |
s | Decrease maximum life of particles |
0 | Toggle field visualization |
9 | Toggle particle visualization |
b | Toggle between planets and blackholes |