Expand description
§windows-animation
Windows Animation wraps the Windows Animation Manager (IUIAnimationManager) for variable
interpolation, transitions, and storyboards. It does not depend on a UI or rendering framework.
Start by adding the following to your Cargo.toml file:
[dependencies.windows-animation]
version = "0.100"use windows_animation::*;
fn main() -> Result<()> {
let manager = Manager::new()?;
let opacity = manager.create_variable(0.0)?;
// Animate from 0.0 to 1.0 over half a second.
let library = TransitionLibrary::new()?;
let fade_in = library.linear(0.5, 1.0)?;
let storyboard = manager.create_storyboard()?;
storyboard.add_transition(&opacity, &fade_in)?;
storyboard.schedule(0.0)?;
// Each frame, advance the clock and read the current value.
manager.update(0.25)?;
let value = opacity.value()?;
assert!((0.0..=1.0).contains(&value));
Ok(())
}Structs§
- Keyframe
- Opaque handle to a point in a storyboard timeline.
- Manager
- Coordinates variables, transitions, and storyboards.
- Storyboard
- Sequences one or more transitions on variables.
- Transition
- A transition that interpolates a variable’s value over time.
- Transition
Library - Provides factory methods for creating common transition types.
- Variable
- An animated value that changes over time as transitions are applied.