PhysLoomPhysics-as-Code

Physics as code

Build physics models in code

Write down bodies, relationships, and motion, then get a physics model you can edit and play.

Pendulum timing

Release a long and a short pendulum together. The shorter one completes more swings in the same time.

two-swings.phys
scene two_swings

support beam orientation=horizontal #blue
pendulum short length=0.6m angle=16deg subject=swing #gold
pendulum long length=1.5m angle=16deg subject=swing #red

short <-> beam
long <-> beam

release short playback=6s
release long playback=6s
show path equilibrium motion
Which swing moves faster? Static pendulum diagram L = 0.6m short L = 1.5m long
Playback speed is adjusted; time readouts still show physical time.
Diagram description

Animated physics diagram: Which swing moves faster?.