windows-animation 0.100.0

Windows animation library
Documentation
  • Coverage
  • 100%
    7 out of 7 items documented1 out of 1 items with examples
  • Size
  • Source code size: 37.8 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 682.4 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 4s Average build duration of successful builds.
  • all releases: 3s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • microsoft/windows-rs
    12852 686 48
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • kennykerr

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(())
}