Module morph

Module morph 

Source
Expand description

Smart boolean interpolation of motion params across a preset transition.

Once both slots’ per-frame equations have written fresh values into their respective evaluator contexts, this module pulls the motion params (zoom / rot / cx / cy / sx / sy / dx / dy / warp) out of both contexts, lerps them linearly by the raw transition progress, and pushes the same lerped values back into both contexts. The downstream warp executor then sees an identical starting state on both chains — what visually feels like a soft tug between the two presets’ compositions.

Boolean flags (wrap, darken_center, invert, brighten, darken, solarize) don’t lerp meaningfully — they snap from the outgoing preset’s value to the incoming one’s at 50 % progress.

This is what MilkDrop calls “smart boolean interpolation”: floats morph, bools switch.

Constants§

BOOL_FLAGS 🔒
Bool-ish flags that snap at the 50 % midpoint instead of lerping.
MOTION_DEFAULTS 🔒
Default fallback per motion var when neither preset wrote it. Matches the defaults that super::state_sync::sync_render_state applies when reading the same vars out to RenderState.motion.
MOTION_VARS 🔒
Continuous motion params that lerp during a transition. Order is load-bearing — snapshot_motion and [write_motion] index into the returned array by position.

Functions§

apply_smart_boolean_interpolation 🔒
Lerp the motion params between the outgoing preset’s slot and the incoming one’s, then push the result into both evaluator contexts.
snapshot_flags 🔒
snapshot_motion 🔒
write_motion_and_flags 🔒