Physics Animations

These interactive physics animations were written using the Java-based visual programming language Processing. For some animations I hand-coded the physics, and others use the Java port of the Box2D C++ physics engine. I used Processing.js to get the animations to run in a browser while following web standards and without needing any plug-ins. More projects are available on GitHub.

ManySprings

Source code: ManySprings

This animation uses Hooke's Law to demonstrate the harmonic oscillations of a mass suspended by a spring. Click anywhere inside the box to create a wood block on a spring. The springs hang down from the ceiling. Click and drag the wood block down (but don't drag outside of the window), then release to see the harmonic oscillation. You can create up to eight springs, and each wood block is created with a random mass.

SlingshotBounce

Source code: SlingshotBounce

This animation demonstrates the parabolic launching of a ball from a slingshot using projectile motion. Click the ball, drag in any direction, and release to see the ball fly through the air and bounce around inside the container. There are no contraints for the height of the ball. The ball will slow down and eventually come to rest, modeling gravity and rolling friction. To launch the ball again, click and drag on the slingshot band, and the ball will reappear in the pocket.