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§
- Liquid
Dynamics - Per-lens frame integrator. Interior-mutable so per-frame draw closures
(plain
Fn) can advance it without aRefCelldance. - Liquid
Pose - 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
LiquidDynamicsfor the calling composition site.