Trait bevy::prelude::Animatable

source ·
pub trait Animatable: Reflect + Sized + 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§

source

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

source

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§

source

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§

source§

impl Animatable for bool

source§

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

source§

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

source§

impl Animatable for f32

source§

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

source§

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

source§

impl Animatable for f64

source§

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

source§

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

Implementors§