pub struct AnimationController { /* private fields */ }Expand description
Controls running animations: pauses and resumes them, moves them to a
point (Progress) and changes their speed (PlaybackRate) (WinUI
AnimationController).
An animation comes under a controller when it is started with
start_animation_with_controller,
or through try_get_animation_controller
of the object it animates. Key frame and natural motion animations can be
controlled; expression animations are not affected. One controller can
control several animations.
Progress and PlaybackRate can be animated
(controller.start_animation("Progress", expression)), and the controller
can be a reference parameter of an expression (controller.Progress).
Implementations§
Source§impl AnimationController
impl AnimationController
Sourcepub const MAX_PLAYBACK_RATE: f32 = 1000.0
pub const MAX_PLAYBACK_RATE: f32 = 1000.0
The highest playback rate (WinUI MaxPlaybackRate).
Sourcepub const MIN_PLAYBACK_RATE: f32 = -1000.0
pub const MIN_PLAYBACK_RATE: f32 = -1000.0
The lowest playback rate (WinUI MinPlaybackRate); a negative rate
plays backwards.
Sourcepub fn compositor(&self) -> &Rc<Compositor>
pub fn compositor(&self) -> &Rc<Compositor>
The compositor of the controller.
Sourcepub fn pause(&self)
pub fn pause(&self)
Pauses the controlled animations: their time stops, and they do not end while paused.
Sourcepub fn playback_rate(&self) -> f32
pub fn playback_rate(&self) -> f32
The speed of the controlled animations: 1 is normal speed, 2 twice as fast, a negative rate plays backwards.
Sourcepub fn set_playback_rate(&self, value: f32)
pub fn set_playback_rate(&self, value: f32)
Sets the playback rate, clamped to
MIN_PLAYBACK_RATE..MAX_PLAYBACK_RATE.
Sourcepub fn set_progress(&self, value: f32)
pub fn set_progress(&self, value: f32)
Moves the controlled animations to a point between their start (0) and their end (1), clamped to that range. A playing animation goes on from there; a paused one stays there.
Sourcepub fn progress_behavior(&self) -> AnimationControllerProgressBehavior
pub fn progress_behavior(&self) -> AnimationControllerProgressBehavior
What the progress covers.
pub fn set_progress_behavior(&self, value: AnimationControllerProgressBehavior)
Trait Implementations§
Source§impl AsCompositionObject for AnimationController
impl AsCompositionObject for AnimationController
Source§fn as_property_set(self: Rc<Self>) -> Option<Rc<CompositionPropertySet>>
fn as_property_set(self: Rc<Self>) -> Option<Rc<CompositionPropertySet>>
An expression refers to the controller through its property set
(controller.Progress).
Source§fn as_composition_object(&self) -> &CompositionObject
fn as_composition_object(&self) -> &CompositionObject
CompositionObject.Source§fn composition_type_name(&self) -> &'static str
fn composition_type_name(&self) -> &'static str
Source§impl ICompositionObjectAnimations for AnimationController
impl ICompositionObjectAnimations for AnimationController
Source§fn try_start_animation(
&self,
property_name: &str,
animation: &dyn ICompositionAnimation,
final_value: Option<ExpressionVariant>,
) -> bool
fn try_start_animation( &self, property_name: &str, animation: &dyn ICompositionAnimation, final_value: Option<ExpressionVariant>, ) -> bool
Progress and PlaybackRate can be animated.
Source§fn get_composition_property(
&self,
property_name: &str,
) -> Option<&'static CompositionProperty>
fn get_composition_property( &self, property_name: &str, ) -> Option<&'static CompositionProperty>
Source§fn composition_object(&self) -> &CompositionObject
fn composition_object(&self) -> &CompositionObject
CompositionObject.Source§fn start_animation(
&self,
property_name: &str,
animation: &dyn ICompositionAnimation,
)
fn start_animation( &self, property_name: &str, animation: &dyn ICompositionAnimation, )
Source§fn start_animation_with_final_value(
&self,
property_name: &str,
animation: &dyn ICompositionAnimation,
final_value: Option<ExpressionVariant>,
)
fn start_animation_with_final_value( &self, property_name: &str, animation: &dyn ICompositionAnimation, final_value: Option<ExpressionVariant>, )
start_animation. property_name may
name a sub-channel of a vector property (Offset.X, Scale.XY,
components X, Y, Z, W in any case): the animation then animates a
value of the sub-channel’s type (a scalar for one component, a
Vector2 for two, …) and leaves the other components alone. Several
sub-channels of one property run together; an animation of the whole
property replaces them.Source§fn start_animation_with_controller(
&self,
property_name: &str,
animation: &dyn ICompositionAnimation,
controller: &Rc<AnimationController>,
)
fn start_animation_with_controller( &self, property_name: &str, animation: &dyn ICompositionAnimation, controller: &Rc<AnimationController>, )
StartAnimation(propertyName, animation, animationController): starts
the animation under controller, which can pause, resume, scrub and
speed it up. property_name may name a sub-channel, as for
start_animation.Source§fn try_get_animation_controller(
&self,
property_name: &str,
) -> Option<Rc<AnimationController>>
fn try_get_animation_controller( &self, property_name: &str, ) -> Option<Rc<AnimationController>>
TryGetAnimationController): the controller it was started with, or
a new controller that takes the running animation over. None when no
animation was started on the property through this object, or it was
stopped.Source§fn stop_animation(&self, property_name: &str)
fn stop_animation(&self, property_name: &str)
property_name may name a sub-channel
(Offset.X): the animations of the sub-channels that share a
component with it are stopped.Source§fn start_animation_group(&self, grp: &dyn ICompositionAnimationBase)
fn start_animation_group(&self, grp: &dyn ICompositionAnimationBase)
Source§fn start_animation_group_part(
&self,
animation: &dyn ICompositionAnimation,
target: &str,
final_value: ExpressionVariant,
) -> bool
fn start_animation_group_part( &self, animation: &dyn ICompositionAnimation, target: &str, final_value: ExpressionVariant, ) -> bool
StartAnimationGroupPart.Source§fn start_animation_group_for(
&self,
grp: &dyn ICompositionAnimationBase,
target: &str,
final_value: ExpressionVariant,
) -> bool
fn start_animation_group_for( &self, grp: &dyn ICompositionAnimationBase, target: &str, final_value: ExpressionVariant, ) -> bool
target to final_value. Returns whether one of the
animations targets that property.Source§fn stop_animation_group(&self, grp: &dyn ICompositionAnimationBase)
fn stop_animation_group(&self, grp: &dyn ICompositionAnimationBase)
Auto Trait Implementations§
impl !Freeze for AnimationController
impl !RefUnwindSafe for AnimationController
impl !Send for AnimationController
impl !Sync for AnimationController
impl !UnwindSafe for AnimationController
impl Unpin for AnimationController
impl UnsafeUnpin for AnimationController
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> ClassDefaults for Twhere
T: ?Sized,
impl<T> ClassDefaults for Twhere
T: ?Sized,
Source§fn static_constructor()
fn static_constructor()
affects_render, metadata
overrides). Read more