Expand description
A library for easily creating animations in Iced. Animations are designed around spring physics to make animations feel natural and interactive.
§Overview
The primary widgets are Animation and AnimationBuilder, which are widgets that help you
animates a value when it changes. The Animation widget allows you to store the animated value
in your app state, while the AnimationBuilder widget maintains the animated value so your app
state is always up-to-date with the latest value. Refer to those widget modules for documentation
and the examples directory for examples on how to use them.
§Animated widgets
A subset of the standard iced widgets are exported under a widgets feature
flag. You can use these as drop-in replacements for the existing widgets:
use iced_anim::widget::button;
fn fancy_button<'a>() -> Element<'a, Message> {
button("Animated button")
.on_press(Message::DoSomething)
.into()
}§Animating types
You can animate anything that implements Animate. A handful of common types already
implement Animate like f32, Color and Theme, with more to come
in the future. You can also derive Animate on your own types to animate them as well
by enabling the derive feature flag and adding #[derive(Animate)] to your type:
use iced_anim::Animate;
// Note that animate also requires `Clone` and `PartialEq` impls.
#[derive(Animate, Clone, PartialEq)]
struct MyType {
size: f32,
color: Color,
}§Controlling the spring motion
The spring motion of an AnimationBuilder can be customized. There are some presets like
[spring::Motion::smooth] and [spring::Motion::bouncy], but you can also create your own.
§Supported Iced versions
This crate supports Iced 0.14 and newer.
Re-exports§
pub use animate::Animate;pub use animated::Animated;pub use animated::AnimationType;pub use animation::Animation;pub use event::Event;pub use spring::Motion;pub use spring::Spring;pub use transition::Easing;pub use transition::Transition;pub use animation_builder::*;
Modules§
- animate
- Core definitions for the
Animatetrait and its implementations. - animated
- animation
- A widget that helps you animate a value over time from your state.
- animation_
builder - Implicitly animate between value changes.
- event
- An event associated with an
crate::Animatedvalue. - spring
- Spring physics to enable natural and interactive animations.
- transition
- A type of animation that transitions between two values by following a curve.
Structs§
- Animated
State - Helps manage animating values for widgets.