Skip to main content

Interpolate

Trait Interpolate 

Source
pub trait Interpolate: Clone {
    // Required method
    fn interpolate(&self, other: &Self, t: f32) -> Self;
}
Expand description

Trait for types that can be interpolated between two values

§Example

use armas_basic::animation::Interpolate;

let a = 0.0_f32;
let b = 10.0_f32;
assert_eq!(a.interpolate(&b, 0.5), 5.0);

Required Methods§

Source

fn interpolate(&self, other: &Self, t: f32) -> Self

Interpolate between self and other by factor t (0.0 to 1.0)

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl Interpolate for f32

Source§

fn interpolate(&self, other: &Self, t: f32) -> Self

Source§

impl Interpolate for f64

Source§

fn interpolate(&self, other: &Self, t: f32) -> Self

Source§

impl Interpolate for Color32

Source§

fn interpolate(&self, other: &Self, t: f32) -> Self

Source§

impl Interpolate for Pos2

Source§

fn interpolate(&self, other: &Self, t: f32) -> Self

Source§

impl Interpolate for Rect

Source§

fn interpolate(&self, other: &Self, t: f32) -> Self

Source§

impl Interpolate for Vec2

Source§

fn interpolate(&self, other: &Self, t: f32) -> Self

Source§

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

Source§

fn interpolate(&self, other: &Self, t: f32) -> Self

Source§

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

Source§

fn interpolate(&self, other: &Self, t: f32) -> Self

Source§

impl<T: Interpolate> Interpolate for Option<T>

Source§

fn interpolate(&self, other: &Self, t: f32) -> Self

Implementors§