stroke_morph 0.1.0
stroke_morph: ^0.1.0 copied to clipboard
Universal morphing for stroke-based icons with spring physics — any icon morphs into any other, with rotations that emerge from the math.
Changelog #
0.1.0 #
First release. An unofficial Dart/Flutter port of morphicons by Guillermo.
- Any stroke icon morphs into any other. Rotations, scalings and folds are not authored — they fall out of a closed-form Procrustes alignment between the two point clouds.
MorphIconwith three modes: uncontrolled (icon), controlled (from/to/progress), and imperative (viaGlobalKey<MorphIconState>).MorphControllerfor driving a morph yourself, withmorphTo/set/seek/progress. Interruptible: re-targeting mid-flight re-plans from the shape on screen and carries the spring's velocity across.- Spring physics with three presets (
smooth,snappy,bouncy), plusstiffness/dampingoverrides. duration— say how long a morph should take instead of how stiff it should be. The duration sets the speed while the damping ratio keeps the character, so a bouncy 900 ms morph still overshoots. Not part of the reference implementation; additive, and the parity suite is unaffected.Duration.zerodisables the animation.- Reduced motion honoured automatically via
MediaQuery.disableAnimationsOf. - Off-grid icon packs supported through
fitIcon; raw SVG throughSvgIcon. - Zero dependencies beyond Flutter itself.
Pinned by 193 tests, including a cross-language parity suite that asserts this implementation agrees with the TypeScript reference byte for byte — plan fields, interpolated frames at t = 0 / 0.25 / 0.5 / 0.75 / 1 / 1.15, and serialized output, over 28 icons and 26 pairs.
Pre-1.0 because the port has not yet been reviewed on a physical device.