[][src]Struct keyframe::Keyframe

pub struct Keyframe<T: CanTween + Copy> { /* fields omitted */ }

Intermediate step in an animation sequence

Methods

impl<T: CanTween + Copy> Keyframe<T>[src]

pub fn new<F: Float>(
    value: T,
    time: F,
    function: impl EasingFunction + 'static + Send + Sync
) -> Self
[src]

Creates a new keyframe from the specified values. If the time value is negative the keyframe will start at 0.0.

Arguments

  • value - The value that this keyframe will be tweened to/from
  • time - The start time in seconds of this keyframe
  • function - The easing function to use from the start of this keyframe to the start of the next keyframe

pub fn value(&self) -> T[src]

The value of this keyframe

pub fn time(&self) -> f64[src]

The time in seconds at which this keyframe starts in a sequence

pub fn function(&self) -> &dyn EasingFunction[src]

The easing function that will be used when tweening to another keyframe

pub fn tween_to(&self, next: &Keyframe<T>, time: impl Float) -> T[src]

Returns the value between this keyframe and the next keyframe at the specified time

Note

The following applies if:

  • The requested time is before the start time of this keyframe: the value of this keyframe is returned
  • The requested time is after the start time of next keyframe: the value of the next keyframe is returned
  • The start time of the next keyframe is before the start time of this keyframe: the value of the next keyframe is returned

Trait Implementations

impl<T: CanTween + Copy + Debug> Debug for Keyframe<T>[src]

impl Default for Keyframe<f32>[src]

impl Default for Keyframe<Vector2<f32>>[src]

impl Default for Keyframe<Point2<f64>>[src]

impl Default for Keyframe<Point3<f64>>[src]

impl Default for Keyframe<Vector3<f32>>[src]

impl Default for Keyframe<Vector4<f32>>[src]

impl Default for Keyframe<Point2<f32>>[src]

impl Default for Keyframe<Point3<f32>>[src]

impl Default for Keyframe<f64>[src]

impl Default for Keyframe<Vector2<f64>>[src]

impl Default for Keyframe<Vector3<f64>>[src]

impl Default for Keyframe<Vector4<f64>>[src]

impl<T: CanTween + Copy + Display> Display for Keyframe<T>[src]

impl<V: CanTween + Copy, T: Float, F: EasingFunction + 'static + Send + Sync> From<(V, T, F)> for Keyframe<V>[src]

fn from(tuple: (V, T, F)) -> Self[src]

Creates a new keyframe from a tuple of (value, time, function). If the time value is negative the keyframe will start at 0.0.

impl<V: CanTween + Copy, T: Float> From<(V, T)> for Keyframe<V>[src]

fn from(tuple: (V, T)) -> Self[src]

Creates a new keyframe from a tuple of (value, time). EaseInOut will be used as the easing function. If the time value is negative the keyframe will start at 0.0.

Auto Trait Implementations

impl<T> !RefUnwindSafe for Keyframe<T>

impl<T> Send for Keyframe<T> where
    T: Send

impl<T> Sync for Keyframe<T> where
    T: Sync

impl<T> Unpin for Keyframe<T> where
    T: Unpin

impl<T> !UnwindSafe for Keyframe<T>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.