Skip to main content

windows_animation/
variable.rs

1use super::*;
2
3/// An animated value that changes over time as transitions are applied.
4#[derive(Clone)]
5pub struct Variable(pub(crate) IUIAnimationVariable2);
6
7impl Variable {
8    /// Returns the current interpolated value.
9    pub fn value(&self) -> Result<f64> {
10        unsafe { self.0.GetValue() }
11    }
12
13    /// Copies the animation curve to a DirectComposition animation object.
14    pub fn copy_curve(&self, animation: &impl Interface) -> Result<()> {
15        unsafe {
16            let dcomp: IDCompositionAnimation = animation.cast()?;
17            self.0.GetCurve(&dcomp).ok()
18        }
19    }
20}