Click and drag to interact.
Press 'R' to reset, and 'G' to toggle the gravity.

Read the full tutorial at Gamedevtuts+.

Built with Processing