Skip to main content

Module motion

Module motion 

Source
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):

§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 TransitionPattern trait plus the four source-verified patterns — FadeThrough, SharedAxis (X/Y/Scaled), FadeScale, and ContainerTransform (rect-to-rect morph + fade-through composite) — that super::switcher::PatternSwitcher stages an outgoing/incoming child pair under. A design system’s own patterns live in its own crate (frust_glyph::motion is the shipped example) and implement the same public trait from there.
switcher
Keyed single-slot child-switch container: PatternSwitcher, Flutter’s PageTransitionSwitcher/AnimatedSwitcher analog. It stages an outgoing/incoming child pair under a TransitionPattern whenever its declared child changes identity (a ChildKey).

Structs§

AnimatedOpacityView
A declarative opacity wrapper. See the module docs.
AnimatedOpacityWidget
The retained widget for an AnimatedOpacityView.
AnimatedScaleView
A declarative scale wrapper. See the module docs.
AnimatedScaleWidget
The retained widget for an AnimatedScaleView.

Functions§

AnimatedOpacity
PascalCase alias for animated_opacity (mirrors Switch/switch’s dual naming).
AnimatedScale
PascalCase alias for animated_scale (mirrors Switch/switch’s dual naming).
animated_opacity
Fade child toward target opacity (clamped to 0.0..=1.0) — see the module docs. Defaults its Timing from the theme’s default_effects spring; override with .timing(...).
animated_scale
Scale child toward target (a scale factor — 1.0 is unscaled; no range restriction, unlike opacity) about Alignment::CENTER by default — see the module docs. Defaults its Timing from the theme’s default_spatial spring; override with .timing(...); override the pivot with .alignment(...).