Skip to main content

Easing

Enum Easing 

Source
pub enum Easing {
    Linear,
    InQuad,
    OutQuad,
    InOutQuad,
    OutCubic,
    InOutCubic,
    OutBack,
    CubicBezier(f32, f32, f32, f32),
}
Expand description

Curva de aceleração (suavização). Como propriedade, é gravada pelo nome (out_quad, ou os do CSS: ease, ease-in…) ou como cubic-bezier(x1, y1, x2, y2).

Variants§

§

Linear

§

InQuad

§

OutQuad

§

InOutQuad

§

OutCubic

§

InOutCubic

§

OutBack

Passa um pouco do destino e volta (efeito “mola” leve).

§

CubicBezier(f32, f32, f32, f32)

Curva de Bézier cúbica de (0,0) a (1,1) com os dois pontos de controle, como a cubic-bezier() do CSS. O x dos pontos fica entre 0 e 1; o y pode passar.

Implementations§

Source§

impl Easing

Source

pub const ALL: [Easing; 7]

Source

pub const NAMES: &'static [&'static str]

Nomes das curvas prontas, na ordem de Easing::ALL.

Source

pub const CSS: [(&'static str, [f32; 4]); 4]

As curvas do CSS (ease, ease-in, ease-out, ease-in-out) com os pontos delas.

Source

pub fn apply(self, t: f32) -> f32

Aplica a curva a t (0..1).

Source

pub fn parse(text: &str) -> Option<Easing>

Lê um nome (out_quad, OutQuad, out-quad), um nome do CSS ou cubic-bezier(x1, y1, x2, y2).

Source

pub fn to_spec(self) -> String

O texto que Easing::parse lê.

Source

pub fn to_bezier(self) -> [f32; 4]

Os pontos de controle da curva como Bézier cúbica (as prontas são aproximações das funções, as mesmas do easings.net). É o que o editor da curva abre para ajustar.

Trait Implementations§

Source§

impl Clone for Easing

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 Easing

Source§

impl Debug for Easing

Source§

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

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

impl Default for Easing

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl EventValue for Easing

Source§

const ARG: EventArg

O que o evento declara no catálogo.
Source§

fn from_args(args: &EventArgs) -> Option<Self>

O valor tirado do args (None: o evento veio com outra coisa).
Source§

impl FromStr for Easing

Source§

type Err = Error

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<Self>

Parses a string s to return a value of this type. Read more
Source§

impl PartialEq for Easing

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 PropType for Easing

Source§

const KIND: PropKind = PropKind::Easing

Source§

fn to_value(&self) -> PropValue

Source§

fn from_value(value: PropValue) -> Result<Self>

Source§

impl StructuralPartialEq for Easing

Auto Trait Implementations§

§

impl Forget for Easing

§

impl Freeze for Easing

§

impl Move for Easing

§

impl RefUnwindSafe for Easing

§

impl Send for Easing

§

impl Sync for Easing

§

impl Unpin for Easing

§

impl UnsafeUnpin for Easing

§

impl UnwindSafe for Easing

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> 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.