aura-anim-iced
Iced-first animation orchestration for applications that need more than a single animated value.
This crate builds on Iced's public animation surface instead of replacing it.
User-facing APIs use Iced types such as iced::Color, iced::Vector,
iced::Size, iced::Rectangle, iced::Shadow, and
iced::animation::Easing. Internal interpolation helpers exist only to sample
multi-property keyframes, timelines, runtime snapshots, and diagnostics.
The v0.1 foundation focuses on:
- typed visual properties and sampled property snapshots;
- timing primitives that use Iced easing directly;
- property keyframes and timeline orchestration;
- a runtime that can gate Iced subscriptions while animations are active;
- Iced integration helpers for applying snapshots in
viewcode.
Use Iced's Animation<T> for direct single-value animation. Use
aura-anim-iced when a UI state change needs coordinated opacity, transform,
size, color, shadow, hold, sequence, parallel, and runtime cleanup behavior.
Status
0.1.0-alpha.1 is an early foundation release. It focuses on typed property
snapshots, keyframes, timelines, runtime ticking, and Iced integration helpers.
Installation
Add the crate to an Iced application:
Enable optional diagnostics when runtime tick events should be visible through
tracing:
The same configuration can be written directly in Cargo.toml:
[]
= "0.1.0-alpha.1"
[]
= { = "0.1.0-alpha.1", = ["inspector"] }
Minimal Runtime Example
Store an AnimationRuntime in application state, register keyframes in update,
keep an Iced tick subscription active while the runtime is playing,
and convert tick output into view effects for one target.
use Instant;
use ;
In view, apply the sampled EffectSnapshot fields to the widget style,
layout, or wrapper code owned by the application.
Animatable Values
Public animation inputs use Iced value types wherever possible. The v0.1 value
model covers scalar values, iced::Vector, iced::Size, iced::Rectangle,
iced::Color, iced::Shadow, and transform-friendly values. Interpolation is
kept internal so application code works with typed properties and sampled
snapshots instead of implementing animation traits.
use ;
use Color;
let fade_and_color = new
.with_timing
.at
.at
.at
.at
.finish;
Property Tracks
Properties are identified by typed PropertySpec values. Built-in specs cover
opacity, translation, scale, size, padding, radius, colors, and shadow.
Applications can also define custom specs when an example or widget needs an
extra sampled value, such as a toast offset.
use ;
const TOAST_Y: =
new;
A PropertySnapshot stores sampled values for one target. When snapshots are
merged, later values replace earlier values with the same property spec and the
result is sorted by composition order.
Keyframes
Use KeyframesBuilder to collect property snapshots at normalized offsets from
0.0 to 1.0, then call finish() to compile them into a Keyframes value.
The finished keyframes own a Timing, so duration, easing, fill mode,
direction, iterations, and playback rate stay attached to the sampled property
data.
use ;
let popup_open = new
.with_timing
.at
.at
.at
.at
.at
.finish;
Duplicate offsets are merged. If the same property appears multiple times at the same offset, the later value wins.
Timeline Orchestration
Timelines combine keyframe tracks into sequences, parallel groups, and holds. Use sequences for lifecycle animation, parallel groups for coordinated property changes, and holds when a state should remain visible before the next step.
use ;
let enter = new;
let exit = new;
let toast_lifecycle = sequence;
Use Timeline::parallel when several tracks should sample at the same time.
Property collisions are resolved by insertion order inside the target snapshot.
Runtime Ticking
AnimationRuntime stores active keyframes and timelines by target ID. Register a
source in update, keep the returned handle if completion cleanup matters, and
route tick output back into application state.
use ;
let mut runtime = new;
let target = new;
let registration = runtime.register_keyframes;
let handle = registration.handle;
Each runtime tick returns target-scoped snapshots plus completed handles. Completed entries are removed automatically after their final output is emitted.
Iced Subscription Wiring
Use iced_ext::subscription to produce ticks only while the runtime has active
animations. Use iced_ext::update_tick to advance the runtime from an Iced tick
message. The runtime tick interval comes from TickPolicy.
use Instant;
use ;
For view code, convert tick output with tick_effect_snapshot_for when using
the built-in effect fields, or read AnimationTick::properties_for directly
when the application owns custom property specs.