Modify the variables to see different results. The simulation only updates after the current animation is complete, although the values are constantly updated.
This is based off of real physics equations. This applies only to one-dimensional head-on collisions. A two-dimensional version may at some point be made. Equations were generated partly by Wolfram|Alpha Code is by me