pub struct Keyframe<T> { /* private fields */ }
Expand description
Intermediate step in an animation sequence
Implementations
sourceimpl<T> Keyframe<T>
impl<T> Keyframe<T>
sourcepub fn new<F: Float>(
value: T,
time: F,
function: impl EasingFunction + 'static + Send + Sync
) -> Self
pub fn new<F: Float>(
value: T,
time: F,
function: impl EasingFunction + 'static + Send + Sync
) -> Self
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/fromtime
- The start time in seconds of this keyframefunction
- The easing function to use from the start of this keyframe to the start of the next keyframe
sourcepub fn new_dynamic<F: Float>(
value: T,
time: F,
function: Box<dyn EasingFunction + Send + Sync + 'static>
) -> Self
pub fn new_dynamic<F: Float>(
value: T,
time: F,
function: Box<dyn EasingFunction + Send + Sync + 'static>
) -> Self
Same as new
, but allows you to supply an easing function which size is not known at compile time.
Arguments
value
- The value that this keyframe will be tweened to/fromtime
- The start time in seconds of this keyframefunction
- The easing function to use from the start of this keyframe to the start of the next keyframe
sourcepub fn function(&self) -> &dyn EasingFunction
pub fn function(&self) -> &dyn EasingFunction
The easing function that will be used when tweening to another keyframe
sourcepub fn tween_to(&self, next: &Keyframe<T>, time: impl Float) -> T where
T: CanTween + Clone,
pub fn tween_to(&self, next: &Keyframe<T>, time: impl Float) -> T where
T: CanTween + Clone,
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
sourceimpl<V, T: Float> From<(V, T, Box<dyn EasingFunction + Send + Sync + 'static, Global>)> for Keyframe<V>
impl<V, T: Float> From<(V, T, Box<dyn EasingFunction + Send + Sync + 'static, Global>)> for Keyframe<V>
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more