Expand description
§anim
This is a framework independent animation library for rust, works nicely with Iced and the others.
§Showcase



§How to install?
Include anim in your Cargo.toml dependencies:
[dependencies]
anim = "0.1"Note: anim turns on iced-backend feature by default. You need to disable default features if you do not work with iced.
[dependencies]
anim = { version="0.1", default-features = false }§How to use?
There are 3 important concepts in anim:
-
AnimatableTypes derived fromAnimatablemeans that its values can be calculated based on timing progress, with which you can createAnimationobjects. -
AnimationTheAnimationgenerates values based on its timing progress. You can construct a bigAnimationfrom small ones. -
TimelineWithTimelineyou can control your animations’ lifetime.
For simple scenarios, you just need Options.
use anim::{Options, Timeline, Animation, easing};Then, build and start your animation:
use std::time::Duration;
use anim::{Options, Timeline, Animation, easing};
let mut timeline = Options::new(20,100).easing(easing::bounce_ease())
.duration(Duration::from_millis(300))
.begin_animation();
loop {
let status = timeline.update();
if status.is_completed() {
break;
}
println!("animated value: {}", timeline.value());
}For complex scenarios, please look at examples to gain some ideas.
Modules§
- animatable
- make a type animatable
- builder
- animation builders
- easing
- ease functions
- local
- thread local based timeline
- timeline
- timeline definitions
- utils
- utilities
Structs§
Enums§
- KeyTime
- key time
- Repeat
Behavior - how an
Animationrepeats its simple duration - Seek
From - seek progress of current animation, only keep the remaining part
Constants§
- DEFAULT_
ANIMATION_ DURATION - default animation time, 1 second
- DURATION_
ZERO
Traits§
- Animatable
- generates output values based on its timing progress
- Animation
- your animation, which outputs animated value based on the progressing time.
- Cursor
- like
Iterator, but does not consume any element - Function
- easing function
Derive Macros§
- Animatable
- the macro derives
anim::Animatablefor you automatically.