Give the interface motion
Responsive motion must handle interruption gracefully: if a user double-taps a task while the progress bar is half-way across, the bar should reverse smoothly from its current position rather than snapping back to zero.
1. Minimal demo: FollowBounds spring selection ring
First, let's isolate the filter bar's selection ring. Below, three buttons have different widths, and a trailing View attaches FollowBounds::new(id("spring_first")).with_transition(...). When a button is tapped, pick_tab sets follower.target = target and the critically damped spring interpolates both position and width:
2. In the task list: retargetable progress tween + filter spring
Now we mount that FollowBounds ring inside filters (interface.rs) and add a custom Progress view driven by aim_progress and #[animate] (motion.rs) in the header:
On each frame, `aim_progress` computes `goal = completed / total`. If `target.0 != goal`, it starts a new motion from the **currently displayed `progress.0`** (`settings.0.motion(progress.0, goal)`).
commands.insert(entity, AnimateProgress(settings.0.motion(progress.0, goal)));Mid-flight retargeting without jump discontinuitiesWhat changed in this step
- Retargeting from the displayed value: In
motion.rs, whenevergoalchanges,aim_progressstarts a new tween from the currently displayedprogress.0(settings.0.motion(progress.0, goal)). - Zero cost at rest:
#[animate(component = AnimateProgress)]updatesProgresseach frame and removesAnimateProgressfrom the entity as soon as the tween settles.
Run on your machine
cargo run -p mirui-first-app --features desktop --example desktop -- 5