You need a physics engine, no matter the language....
# tribe
t
You need a physics engine, no matter the language. On web there are a bunch of those in js. A very simple one that understands spring forces and object dimensions is probably sufficient. It is nontrivial to implement it. Canvas element on web allows you to draw anything pixel by pixel. On mobile or desktop you have low level display libraries that do the same thing. Rendering engines are libraries that translate high level instructions like line, curve, character, image/icon into pixels. Physics engines let you think and code in terms of objects and laws of interaction, and work with rendering engines.