Skip to main content

Animatable

Trait Animatable 

Source
pub trait Animatable: Clone {
    type AnimatableData: Interpolatable;

    // Required methods
    fn animatable_data(&self) -> Self::AnimatableData;
    fn from_animatable_data(data: Self::AnimatableData) -> Self;
}
Expand description

SwiftUI-style animation protocol.

Types expose an animatable representation (AnimatableData) that can be linearly interpolated by the animation system.

Required Associated Types§

Source

type AnimatableData: Interpolatable

Interpolatable payload used for frame-to-frame value blending.

Required Methods§

Source

fn animatable_data(&self) -> Self::AnimatableData

Exports the value to its animatable representation.

Source

fn from_animatable_data(data: Self::AnimatableData) -> Self

Reconstructs the value from animatable data.

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 f32

Source§

impl Animatable for f64

Source§

impl<A: Animatable, B: Animatable, C: Animatable, D: Animatable> Animatable for (A, B, C, D)

Source§

impl<A: Animatable, B: Animatable, C: Animatable> Animatable for (A, B, C)

Source§

impl<A: Animatable, B: Animatable> Animatable for (A, B)

Source§

impl<T: Animatable + Copy, const N: usize> Animatable for [T; N]
where T::AnimatableData: Copy,

Implementors§