Skip to main content

Animatable

Trait Animatable 

Source
pub trait Animatable: Copy {
    const REST: f32;

    // Required methods
    fn to_components(self) -> [f32; 4];
    fn from_components(c: [f32; 4]) -> Self;
}
Expand description

A value that can be animated: up to four numbers that add and subtract.

Required Associated Constants§

Source

const REST: f32

Below this distance from the target, the animation counts as finished.

Required Methods§

Source

fn to_components(self) -> [f32; 4]

The value as numbers to interpolate.

Source

fn from_components(c: [f32; 4]) -> Self

The value back from interpolated numbers, which may overshoot.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl Animatable for Color

Source§

const REST: f32 = 0.002

Source§

fn to_components(self) -> [f32; 4]

Source§

fn from_components(c: [f32; 4]) -> Self

Source§

impl Animatable for Effect

Source§

const REST: f32 = 0.002

Source§

fn to_components(self) -> [f32; 4]

Source§

fn from_components(c: [f32; 4]) -> Self

Source§

impl Animatable for Point

Source§

const REST: f32 = 0.02

Source§

fn to_components(self) -> [f32; 4]

Source§

fn from_components(c: [f32; 4]) -> Self

Source§

impl Animatable for Rect

Source§

const REST: f32 = 0.02

Source§

fn to_components(self) -> [f32; 4]

Source§

fn from_components(c: [f32; 4]) -> Self

Source§

impl Animatable for f32

Source§

const REST: f32 = 0.001

Source§

fn to_components(self) -> [f32; 4]

Source§

fn from_components(c: [f32; 4]) -> Self

Implementors§