Skip to main content

Transition

Struct Transition 

Source
pub struct Transition {
    pub duration_ms: f32,
    pub easing: Easing,
    pub repeat: Repeat,
    pub bounce: Option<Bounce>,
    pub delay_ms: f32,
}
Expand description

How a node’s animatable values move when the view changes them: a duration, an easing (a timed curve or a spring), and for keyframes a repeat direction and a delay. Built with Transition::ms and the builders, or through the NodeSpec shorthands (transition, easing, bounce, repeat, delay).

Fields§

§duration_ms: f32

How long a timed curve takes; for a spring, its response time — about how long it takes to get there.

§easing: Easing§repeat: Repeat

How the node’s keyframes cycle (nothing without keyframes).

§bounce: Option<Bounce>

A spring’s bounce in place of its easing’s own; on a timed curve it makes the transition a spring (Self::curve). None is the easing’s.

§delay_ms: f32

Holds the keyframe cycle back by this many ms, so siblings given different delays run out of phase (CSS’s animation-delay).

Implementations§

Source§

impl Transition

Source

pub fn ms(duration_ms: f32) -> Self

A cubic ease-out over duration_ms.

Source

pub fn easing(self, easing: Easing) -> Self

The curve or spring to move by.

Source

pub fn repeat(self, repeat: Repeat) -> Self

How keyframes cycle (CSS’s animation-direction).

Source

pub fn delay(self, delay_ms: f32) -> Self

Holds a keyframe cycle back by delay_ms (CSS’s animation-delay).

Source

pub fn bounce(self, bounce: f32) -> Self

Springs with this bounce, 0 (no overshoot) to MAX_BOUNCE: on a spring easing in place of its own, and on a timed one in place of the curve, since a bounce is only a spring’s to have.

Source

pub fn curve(&self) -> Easing

The easing this transition moves by: its easing, or Easing::Spring when a bounce was given to a timed curve.

Trait Implementations§

Source§

impl Clone for Transition

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Transition

Source§

impl Debug for Transition

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Transition

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Transition

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.