windows_animation/
storyboard.rs1use super::*;
2
3#[derive(Clone, Copy)]
5pub struct Keyframe(UI_ANIMATION_KEYFRAME);
6
7#[derive(Clone)]
9pub struct Storyboard(pub(crate) IUIAnimationStoryboard2);
10
11impl Storyboard {
12 pub fn add_transition(&self, variable: &Variable, transition: &Transition) -> Result<Keyframe> {
14 unsafe {
15 self.0.AddTransition(&variable.0, &transition.0).ok()?;
16 let kf = self.0.AddKeyframeAfterTransition(&transition.0)?;
17 Ok(Keyframe(kf))
18 }
19 }
20
21 pub fn add_transition_at_keyframe(
23 &self,
24 variable: &Variable,
25 transition: &Transition,
26 keyframe: Keyframe,
27 ) -> Result<()> {
28 unsafe {
29 self.0
30 .AddTransitionAtKeyframe(&variable.0, &transition.0, keyframe.0)
31 .ok()
32 }
33 }
34
35 pub fn schedule(&self, time: f64) -> Result<()> {
37 unsafe { self.0.Schedule(time, None) }.ok()?;
38 Ok(())
39 }
40}