Trait bevy::prelude::Animatable

pub trait Animatable: Sized + Reflect + Send + Sync + 'static {
    // Required methods
    fn interpolate(a: &Self, b: &Self, time: f32) -> Self;
    fn blend(inputs: impl Iterator<Item = BlendInput<Self>>) -> Self;

    // Provided method
    fn post_process(&mut self, _world: &World) { ... }
}
Expand description

An animatable value type.

Required Methods§

fn interpolate(a: &Self, b: &Self, time: f32) -> Self

Interpolates between a and b with a interpolation factor of time.

The time parameter here may not be clamped to the range [0.0, 1.0].

fn blend(inputs: impl Iterator<Item = BlendInput<Self>>) -> Self

Blends one or more values together.

Implementors should return a default value when no inputs are provided here.

Provided Methods§

fn post_process(&mut self, _world: &World)

Post-processes the value using resources in the World. Most animatable types do not need to implement this.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

§

impl Animatable for bool

§

fn interpolate(a: &bool, b: &bool, t: f32) -> bool

§

fn blend(inputs: impl Iterator<Item = BlendInput<bool>>) -> bool

§

impl Animatable for f32

§

fn interpolate(a: &f32, b: &f32, t: f32) -> f32

§

fn blend(inputs: impl Iterator<Item = BlendInput<f32>>) -> f32

§

impl Animatable for f64

§

fn interpolate(a: &f64, b: &f64, t: f32) -> f64

§

fn blend(inputs: impl Iterator<Item = BlendInput<f64>>) -> f64

Implementors§