pub struct Motion { /* private fields */ }Expand description
Animated values for a view’s opacity and the parts of its transform
(TS: createMotion), and motions to play on them: presets
(crate::animation::MotionPreset: entrances, exits, attention seekers,
loops) or keyframes of the app’s own (MotionSpec). Bind it with
[super::Styled::bind_motion]. A Copy handle, kept by the owner
current when it is made, as an AnimatedValue is.
let card = motion().entering(MotionPreset::FadeInUp);
view().bind_motion(&card).on_press(move || {
card.play(MotionPreset::Pulse);
})Implementations§
Source§impl Motion
impl Motion
Sourcepub fn value(&self, channel: MotionChannel) -> AnimatedValue
pub fn value(&self, channel: MotionChannel) -> AnimatedValue
The value of channel (opacity 0..1, translations in points,
rotations in degrees, scales).
Sourcepub fn entering(self, motion: impl Into<MotionSpec>) -> Self
pub fn entering(self, motion: impl Into<MotionSpec>) -> Self
Starting where motion starts and playing it at once: a view that
comes in shows its first frame where the motion begins.
Sourcepub fn play(&self, motion: impl Into<MotionSpec>) -> AnimationEnd
pub fn play(&self, motion: impl Into<MotionSpec>) -> AnimationEnd
Plays motion on its channels (a new one interrupts the one
playing). When the user asks for less motion
(super::reduce_motion), it lands where it ends without moving.
Sourcepub fn play_ignoring_reduce_motion(
&self,
motion: impl Into<MotionSpec>,
) -> AnimationEnd
pub fn play_ignoring_reduce_motion( &self, motion: impl Into<MotionSpec>, ) -> AnimationEnd
Plays motion even when the user asks for less motion.
Sourcepub fn animation(&self, motion: impl Into<MotionSpec>) -> Animation
pub fn animation(&self, motion: impl Into<MotionSpec>) -> Animation
motion as an Animation to compose, not started (TS:
motion.animation(..)): Animation::stagger_from(60.0, StaggerFrom::Center, cards.iter().map(|m| m.animation(..))). Like
Self::play, it lands at its end when the user asks for less
motion (as things are when it is made).