Skip to main content

LayoutCurve

Enum LayoutCurve 

Source
pub enum LayoutCurve {
    Linear,
    EaseIn,
    EaseOut,
    EaseInEaseOut,
    Spring(Spring),
    FittedSpring {
        damping_ratio: f32,
    },
    Keyboard,
    Bezier([f32; 4]),
}
Expand description

Timing curve of a layout animation.

Variants§

§

Linear

Constant speed.

§

EaseIn

Accelerates.

§

EaseOut

Decelerates.

§

EaseInEaseOut

Accelerates, then decelerates.

§

Spring(Spring)

A spring’s physics (LayoutTransition::spring): it times itself, lasting until it settles (Spring::settle_ms), and moves the same on every platform. The transition’s duration_ms is not used. Its velocity and frame_rate are not either: a layout moves from rest at the screen’s rate. JS names it with a type: "spring" phase’s stiffness, damping or mass.

§

FittedSpring

A spring of this damping ratio fitted into the transition’s duration, which each platform draws with its own spring: the JS LayoutAnimation’s type: "spring" (springDamping) without a stiffness, damping or mass. Rust prefers LayoutCurve::Spring.

Fields

§damping_ratio: f32

Damping ratio (0..1): 1 does not overshoot.

§

Keyboard

The software keyboard’s motion (type: "keyboard"): the curve the system moves its keyboard with, timed from when the keyboard started to move, so that what makes room for it moves with it (the duration is the keyboard’s, keyboard_duration). Where there is no software keyboard, or nothing moved it, it eases in and out.

§

Bezier([f32; 4])

A cubic Bézier [x1, y1, x2, y2] over the transition’s duration, as CSS cubic-bezier() (type: "bezier" with bezier in JS): the curve an app’s design names. The x of each control point is clamped to 0..1.

Implementations§

Source§

impl LayoutCurve

Source

pub fn bezier(x1: f32, y1: f32, x2: f32, y2: f32) -> Self

A cubic Bézier [x1, y1, x2, y2] (LayoutCurve::Bezier), each control point’s x clamped to 0..1.

Trait Implementations§

Source§

impl Clone for LayoutCurve

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 LayoutCurve

Source§

impl Debug for LayoutCurve

Source§

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

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

impl PartialEq for LayoutCurve

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 LayoutCurve

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<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> Same for T

Source§

type Output = T

Should always be Self
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.