I made a little Processing sketch based on the same physics as JavaScript physics.
Source code: Chain Link