Tweenable

Trait Tweenable 

Source
pub trait Tweenable:
    Copy
    + Send
    + Sync
    + 'static {
    // Required method
    fn lerp(self, other: Self, t: f32) -> Self;
}
Expand description

A value that can be interpolated between two points.

Types implementing this trait can be animated using [Tween].

§Examples

use eazy_tweener::Tweenable;

let a = 0.0_f32;
let b = 100.0_f32;
let mid = a.lerp(b, 0.5);

assert_eq!(mid, 50.0);

Required Methods§

Source

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

Linearly interpolate between self and other by factor t.

When t = 0.0, returns self. When t = 1.0, returns other. Values outside [0, 1] extrapolate beyond the endpoints.

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 Tweenable for (f32, f32)

Source§

fn lerp(self, other: (f32, f32), t: f32) -> (f32, f32)

Source§

impl Tweenable for (f32, f32, f32)

Source§

fn lerp(self, other: (f32, f32, f32), t: f32) -> (f32, f32, f32)

Source§

impl Tweenable for (f32, f32, f32, f32)

Source§

fn lerp(self, other: (f32, f32, f32, f32), t: f32) -> (f32, f32, f32, f32)

Source§

impl Tweenable for f32

Source§

fn lerp(self, other: f32, t: f32) -> f32

Source§

impl Tweenable for f64

Source§

fn lerp(self, other: f64, t: f32) -> f64

Source§

impl Tweenable for i32

Source§

fn lerp(self, other: i32, t: f32) -> i32

Source§

impl Tweenable for u32

Source§

fn lerp(self, other: u32, t: f32) -> u32

Source§

impl Tweenable for [f32; 2]

Source§

fn lerp(self, other: [f32; 2], t: f32) -> [f32; 2]

Source§

impl Tweenable for [f32; 3]

Source§

fn lerp(self, other: [f32; 3], t: f32) -> [f32; 3]

Source§

impl Tweenable for [f32; 4]

Source§

fn lerp(self, other: [f32; 4], t: f32) -> [f32; 4]

Source§

impl Tweenable for [f64; 2]

Source§

fn lerp(self, other: [f64; 2], t: f32) -> [f64; 2]

Source§

impl Tweenable for [f64; 3]

Source§

fn lerp(self, other: [f64; 3], t: f32) -> [f64; 3]

Source§

impl Tweenable for [f64; 4]

Source§

fn lerp(self, other: [f64; 4], t: f32) -> [f64; 4]

Implementors§