Skip to main content

Module animations

Module animations 

Source
Expand description

Animation wrapper widgets — subtree wrappers that drive a framework Signal<f32> to animate a paint-time property (opacity, transform, layout slot) on the wrapped child.

These wrappers all reuse the framework’s animation infrastructure (Signal<f32>::animate_to, BuildContext::animate(), MotionTokens durations, prefers-reduced-motion) — they do not schedule timers themselves.

  • Fade — opacity 0 ↔ 1, layout-transparent.
  • Collapse — height 0 ↔ natural, layout-driving.
  • Unroll — width 0 ↔ natural, layout-driving (horizontal Collapse).

Spinner is a separate concern: it is a leaf widget (shader-driven AnimatedQuadKind::SpinnerArc), not a subtree wrapper, and lives at the crate root.

Re-exports§

pub use blur::Blur;
pub use collapse::Collapse;
pub use crossfade::Crossfade;
pub use cycle::Cycle;
pub use fade::Fade;
pub use pulse::Pulse;
pub use rotate::Rotate;
pub use scale::Scale;
pub use scale::ScaleOrigin;
pub use shake::Shake;
pub use slide::Slide;
pub use slide::SlideEdge;
pub use smooth_size::SmoothSize;
pub use smooth_size::SmoothSizeAxes;
pub use unroll::Unroll;
pub use unroll::UnrollFrom;

Modules§

blur
Blur — a wrapper widget that applies a Gaussian-equivalent blur to its child subtree, driven by a Prop<f32> radius (in logical pixels).
collapse
Collapse — a wrapper widget that animates its child between hidden and natural size when an external Signal<bool> toggles.
crossfade
Crossfade — when an external Signal<K> changes, the previous content fades out while the new content fades in over the same window. Like Switcher, but animated.
cycle
Cycle — show one of N children at a time, advancing on a fixed period. The “rotating loading tip” / status display pattern.
fade
Fade — a wrapper widget that animates its child between hidden (opacity 0) and visible (opacity 1) when an external Signal<bool> toggles.
pulse
Pulse — a wrapper widget that pulses its child’s opacity between a min and max value on a fixed period, sine-shaped.
rotate
Rotate — wraps a child and applies a 2D rotation to its entire subtree, driven by an external Prop<f32> of radians. Layout- stable: the wrapper reports the child’s natural size at all angles; only the visual content rotates within the slot.
scale
Scale — wraps a child and animates a uniform 2D scale on its entire subtree when an external Prop<bool> toggles. Drives a progress: Signal<f32> ∈ [0, 1] (0 = invisible, 1 = at rest) and applies it as a centered (or origin-pivoted) scale transform via [BuildContext::set_transform] — the renderer’s transform stack composes it onto the subtree.
shake
Shake — wraps a child and plays a damped horizontal oscillation whenever an external trigger Signal<u32> is bumped. The classic invalid-input feedback: wrong password, failed form validation, “no more results” wall.
slide
Slide — wraps a child and slides it in or out from a chosen edge when an external Signal<bool> toggles. Common patterns: drawers, snackbars, side panels, banner notifications.
smooth_size
SmoothSize — auto-sizes the slot to fit the child’s intrinsic size, but tweens the change instead of jumping. The “empty panel that suddenly must grow gracefully to accept new content” pattern.
unroll
Unroll — the horizontal sibling of Collapse.