The full code of the example is in the
PharoJsExamples package under the
PhysicsSimulation tag. The HTML code is in folder
Download the ZIP archive with files used for demo.