PhysLoomPhysics-as-Code

Physics as code

用代码构建物理模型

写下物体、关系和运动,立即得到可以修改与播放的物理模型。

摆的快慢

同时放开一长一短两个摆。短摆会在相同时间里往返更多次。

two-swings.phys
scene two_swings

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

short <-> beam
long <-> beam

animate duration=3s speed=0.5
show short.path short.equilibrium long.path long.equilibrium
哪个秋千摆得更快? 静态摆图 L = 0.6m short L = 1.5m long
时间 0s 动画已调整播放速度,时间读数仍为真实物理时间。
图示说明

动态物理图:哪个秋千摆得更快?;展示时间。