Expand description
The motion module: declarative
implicit-animation wrappers (AnimatedOpacity/AnimatedScale today;
switcher/patterns land later) over frust-core’s anim
vocabulary. Re-exported wholesale
(pub use frust_widgets::motion;), mirroring frust_widgets::icons’s
existing wholesale-module precedent — the only other one in this facade —
so later types under frust_widgets::motion ride along under
frust::motion::* with no further facade edits (see that module’s own
docs for the full rationale).
use frust::motion::{AnimatedOpacity, AnimatedOpacityView, AnimatedScale};
use frust::text;
let _opacity: AnimatedOpacityView<()> = AnimatedOpacity(1.0, text("hi"));
let _scale: frust::motion::AnimatedScaleView<()> = AnimatedScale(1.0, text("hi"));Motion module: declarative single-child animation wrappers built over
frust-core’s anim vocabulary
(frust_core::AnimationController/frust_core::Curve/
frust_core::Tween/frust_core::Spring) and the paint-only
push_layer/push_transform compositing primitives
(frust_core::PaintScene).
§Module map
Every motion module is pre-declared here so each module’s code lives in
its own file and never spills into this module list (mirrors
nav/mod.rs’s module-map precedent):
animated—AnimatedOpacity/AnimatedScale: declarative single-child implicit-animation wrappers. A target-value change retargets smoothly (no jump), timed from the theme’sfrust_theme::MotionSchemeby default, or an explicitcrate::Timingoverride.switcher—switcher::PatternSwitcher, a cross-fading child-switch wrapper (Flutter’sAnimatedSwitcher).patterns— higher-level motion patterns (e.g. staggered reveals) composed overanimated/switcher.
§Wholesale facade re-export
Unlike the baseline widgets’ flat per-type re-export lists, the
frust facade re-exports this module wholesale
(pub use frust_widgets::motion;), mirroring the existing
pub use frust_widgets::icons; precedent — the only other wholesale
module re-export in the facade today. This lets any future addition to
this module ride along under frust::motion::* with no further facade
edits required.
Modules§
- animated
- Declarative single-child implicit-animation wrappers:
AnimatedOpacity/AnimatedScale. - patterns
- Core transition patterns: the object-safe
TransitionPatterntrait plus the four source-verified patterns —FadeThrough,SharedAxis(X/Y/Scaled),FadeScale, andContainerTransform(rect-to-rect morph + fade-through composite) — thatsuper::switcher::PatternSwitcherstages an outgoing/incoming child pair under. A design system’s own patterns live in its own crate (frust_glyph::motionis the shipped example) and implement the same public trait from there. - switcher
- Keyed single-slot child-switch container:
PatternSwitcher, Flutter’sPageTransitionSwitcher/AnimatedSwitcheranalog. It stages an outgoing/incoming child pair under aTransitionPatternwhenever its declared child changes identity (aChildKey).
Structs§
- Animated
Opacity View - A declarative opacity wrapper. See the module docs.
- Animated
Opacity Widget - The retained widget for an
AnimatedOpacityView. - Animated
Scale View - A declarative scale wrapper. See the module docs.
- Animated
Scale Widget - The retained widget for an
AnimatedScaleView.
Functions§
- Animated
Opacity - PascalCase alias for
animated_opacity(mirrorsSwitch/switch’s dual naming). - Animated
Scale - PascalCase alias for
animated_scale(mirrorsSwitch/switch’s dual naming). - animated_
opacity - Fade
childtowardtargetopacity (clamped to0.0..=1.0) — see the module docs. Defaults itsTimingfrom the theme’sdefault_effectsspring; override with.timing(...). - animated_
scale - Scale
childtowardtarget(a scale factor —1.0is unscaled; no range restriction, unlike opacity) aboutAlignment::CENTERby default — see the module docs. Defaults itsTimingfrom the theme’sdefault_spatialspring; override with.timing(...); override the pivot with.alignment(...).