Skip to main content

Module dynamics

Module dynamics 

Source
Expand description

Water-droplet motion physics shared by every travelling liquid lens.

The reference lens (example/iphone17_records, example/target/tab-swipe) deforms with its motion, not with its position: cruising speed stretches the bubble along the travel axis, acceleration compresses it against the push, deceleration releases that compression past neutral and swells the leading edge — and whatever one axis does, the orthogonal axis does in reverse so the droplet keeps its area (an incompressible bubble).

LiquidDynamics is the one frame integrator implementing that law. Widgets feed it the lens ride position once per drawn frame (from inside their glass_effect_with closure) and map the returned LiquidPose onto the morph uniforms. Time comes from the runtime’s animation clock — never wall time — so poses stay exact under robot keyframe captures and on wasm.

Structs§

LiquidDynamics
Per-lens frame integrator. Interior-mutable so per-frame draw closures (plain Fn) can advance it without a RefCell dance.
LiquidPose
Motion-derived deformation of a liquid lens for one frame.

Constants§

BULGE_MAX
STRETCH_MAX
STRETCH_MIN
The droplet never deforms past these bounds, however violent the fling. Public so hosting nodes can budget layout headroom for the extremes.

Functions§

remember_liquid_dynamics
Remember one LiquidDynamics for the calling composition site.