programmable-matter allows to draw physics simulations in your browser. To see what it is capable of check out the demo and have a look at the feature list.
To top layer of programmable-matter is a multistroke recognizer we trained to be able to draw Circles, Rectangles and Arrows.
The physics simulations take place in matter.js a 2D physics engine with everything you may need.