Trait tween::Tween

source ·
pub trait Tween<Value> {
    // Required method
    fn tween(&mut self, value_delta: Value, percent: f32) -> Value;

    // Provided method
    fn is_finite(&self) -> bool { ... }
}
Expand description

This is the core trait of the Library, which all tweens implement.

Required Methods§

source

fn tween(&mut self, value_delta: Value, percent: f32) -> Value

Returns a new value based on the value_delta and the percent.

Linear, for example, is implemented simply as:

value_delta.scale(percent)

which is just value_delta * percent.

Provided Methods§

source

fn is_finite(&self) -> bool

All Tweens in this library use this default method, except Looper and Oscillator, which which are both unbounded (because they never stop returning values), and Extrapolator, which simply unbounds tweens.

This is used by Tweener and FixedTweener to determine when to clamp and when a tween will return true for Tweener::is_finished.

If you have a Tween which returns valid values at all percentage ranges at all times, you should return false.

If you would like to extrapolate a tween beyond its bounds, you can wrap it in Extrapolator.

Trait Implementations§

source§

impl<'a, Value> Tween<Value> for &'a mut dyn Tween<Value>
where Value: TweenValue,

source§

fn tween(&mut self, value_delta: Value, percent: f32) -> Value

Returns a new value based on the value_delta and the percent. Read more
source§

fn is_finite(&self) -> bool

All Tweens in this library use this default method, except Looper and Oscillator, which which are both unbounded (because they never stop returning values), and Extrapolator, which simply unbounds tweens. Read more
source§

impl<Value: TweenValue> Tween<Value> for Box<dyn Tween<Value>>

source§

fn tween(&mut self, value_delta: Value, percent: f32) -> Value

Returns a new value based on the value_delta and the percent. Read more
source§

fn is_finite(&self) -> bool

All Tweens in this library use this default method, except Looper and Oscillator, which which are both unbounded (because they never stop returning values), and Extrapolator, which simply unbounds tweens. Read more
source§

impl<Value: TweenValue> Tween<Value> for Box<dyn Tween<Value> + Send>

source§

fn tween(&mut self, value_delta: Value, percent: f32) -> Value

Returns a new value based on the value_delta and the percent. Read more
source§

fn is_finite(&self) -> bool

All Tweens in this library use this default method, except Looper and Oscillator, which which are both unbounded (because they never stop returning values), and Extrapolator, which simply unbounds tweens. Read more
source§

impl<Value: TweenValue> Tween<Value> for Box<dyn Tween<Value> + Send + Sync>

source§

fn tween(&mut self, value_delta: Value, percent: f32) -> Value

Returns a new value based on the value_delta and the percent. Read more
source§

fn is_finite(&self) -> bool

All Tweens in this library use this default method, except Looper and Oscillator, which which are both unbounded (because they never stop returning values), and Extrapolator, which simply unbounds tweens. Read more
source§

impl<Value: TweenValue> Tween<Value> for Box<dyn Tween<Value> + Send + Sync + Unpin>

source§

fn tween(&mut self, value_delta: Value, percent: f32) -> Value

Returns a new value based on the value_delta and the percent. Read more
source§

fn is_finite(&self) -> bool

All Tweens in this library use this default method, except Looper and Oscillator, which which are both unbounded (because they never stop returning values), and Extrapolator, which simply unbounds tweens. Read more
source§

impl<Value: TweenValue> Tween<Value> for Box<dyn Tween<Value> + Send + Unpin>

source§

fn tween(&mut self, value_delta: Value, percent: f32) -> Value

Returns a new value based on the value_delta and the percent. Read more
source§

fn is_finite(&self) -> bool

All Tweens in this library use this default method, except Looper and Oscillator, which which are both unbounded (because they never stop returning values), and Extrapolator, which simply unbounds tweens. Read more
source§

impl<Value: TweenValue> Tween<Value> for Box<dyn Tween<Value> + Sync>

source§

fn tween(&mut self, value_delta: Value, percent: f32) -> Value

Returns a new value based on the value_delta and the percent. Read more
source§

fn is_finite(&self) -> bool

All Tweens in this library use this default method, except Looper and Oscillator, which which are both unbounded (because they never stop returning values), and Extrapolator, which simply unbounds tweens. Read more
source§

impl<Value: TweenValue> Tween<Value> for Box<dyn Tween<Value> + Unpin>

source§

fn tween(&mut self, value_delta: Value, percent: f32) -> Value

Returns a new value based on the value_delta and the percent. Read more
source§

fn is_finite(&self) -> bool

All Tweens in this library use this default method, except Looper and Oscillator, which which are both unbounded (because they never stop returning values), and Extrapolator, which simply unbounds tweens. Read more

Implementations on Foreign Types§

source§

impl<Value: TweenValue> Tween<Value> for Box<dyn Tween<Value> + Send + Sync + Unpin>

source§

fn tween(&mut self, value_delta: Value, percent: f32) -> Value

source§

fn is_finite(&self) -> bool

source§

impl<Value: TweenValue> Tween<Value> for Box<dyn Tween<Value> + Send + Sync>

source§

fn tween(&mut self, value_delta: Value, percent: f32) -> Value

source§

fn is_finite(&self) -> bool

source§

impl<Value: TweenValue> Tween<Value> for Box<dyn Tween<Value> + Send + Unpin>

source§

fn tween(&mut self, value_delta: Value, percent: f32) -> Value

source§

fn is_finite(&self) -> bool

source§

impl<Value: TweenValue> Tween<Value> for Box<dyn Tween<Value> + Send>

source§

fn tween(&mut self, value_delta: Value, percent: f32) -> Value

source§

fn is_finite(&self) -> bool

source§

impl<Value: TweenValue> Tween<Value> for Box<dyn Tween<Value> + Sync>

source§

fn tween(&mut self, value_delta: Value, percent: f32) -> Value

source§

fn is_finite(&self) -> bool

source§

impl<Value: TweenValue> Tween<Value> for Box<dyn Tween<Value> + Unpin>

source§

fn tween(&mut self, value_delta: Value, percent: f32) -> Value

source§

fn is_finite(&self) -> bool

source§

impl<Value: TweenValue> Tween<Value> for Box<dyn Tween<Value>>

source§

fn tween(&mut self, value_delta: Value, percent: f32) -> Value

source§

fn is_finite(&self) -> bool

Implementors§

source§

impl<'a, Value> Tween<Value> for &'a mut dyn Tween<Value>
where Value: TweenValue,

source§

impl<Value> Tween<Value> for BackIn
where Value: TweenValue,

source§

impl<Value> Tween<Value> for BackInOut
where Value: TweenValue,

source§

impl<Value> Tween<Value> for BackOut
where Value: TweenValue,

source§

impl<Value> Tween<Value> for BounceIn
where Value: TweenValue,

source§

impl<Value> Tween<Value> for BounceInOut
where Value: TweenValue,

source§

impl<Value> Tween<Value> for BounceOut
where Value: TweenValue,

source§

impl<Value> Tween<Value> for CircIn
where Value: TweenValue,

source§

impl<Value> Tween<Value> for CircInOut
where Value: TweenValue,

source§

impl<Value> Tween<Value> for CircOut
where Value: TweenValue,

source§

impl<Value> Tween<Value> for CubicIn
where Value: TweenValue,

source§

impl<Value> Tween<Value> for CubicInOut
where Value: TweenValue,

source§

impl<Value> Tween<Value> for CubicOut
where Value: TweenValue,

source§

impl<Value> Tween<Value> for ElasticIn
where Value: TweenValue,

source§

impl<Value> Tween<Value> for ElasticInOut
where Value: TweenValue,

source§

impl<Value> Tween<Value> for ElasticOut
where Value: TweenValue,

source§

impl<Value> Tween<Value> for ExpoIn
where Value: TweenValue,

source§

impl<Value> Tween<Value> for ExpoInOut
where Value: TweenValue,

source§

impl<Value> Tween<Value> for ExpoOut
where Value: TweenValue,

source§

impl<Value> Tween<Value> for Linear
where Value: TweenValue,

source§

impl<Value> Tween<Value> for QuadIn
where Value: TweenValue,

source§

impl<Value> Tween<Value> for QuadInOut
where Value: TweenValue,

source§

impl<Value> Tween<Value> for QuadOut
where Value: TweenValue,

source§

impl<Value> Tween<Value> for QuartIn
where Value: TweenValue,

source§

impl<Value> Tween<Value> for QuartInOut
where Value: TweenValue,

source§

impl<Value> Tween<Value> for QuartOut
where Value: TweenValue,

source§

impl<Value> Tween<Value> for QuintIn
where Value: TweenValue,

source§

impl<Value> Tween<Value> for QuintInOut
where Value: TweenValue,

source§

impl<Value> Tween<Value> for QuintOut
where Value: TweenValue,

source§

impl<Value> Tween<Value> for SineIn
where Value: TweenValue,

source§

impl<Value> Tween<Value> for SineInOut
where Value: TweenValue,

source§

impl<Value> Tween<Value> for SineOut
where Value: TweenValue,

source§

impl<Value, F> Tween<Value> for F
where F: FnMut(Value, f32) -> Value, Value: TweenValue,

source§

impl<Value, T> Tween<Value> for Extrapolator<T>
where Value: TweenValue, T: Tween<Value>,

source§

impl<Value, T> Tween<Value> for Looper<T>
where Value: TweenValue, T: Tween<Value>,

source§

impl<Value, T> Tween<Value> for Oscillator<T>
where Value: TweenValue, T: Tween<Value>,