Demo physics simulation. Click near a ball and drag it around.
Read this article for an explanation of how this code works.
Source code is available in this GitHub repo.