pub struct Keyframe<T> { /* private fields */ }
Expand description
Intermediate step in an animation sequence
Implementations§
Source§impl<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
pub fn tween_to(&self, next: &Keyframe<T>, time: impl Float) -> T
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§
Auto Trait Implementations§
impl<T> Freeze for Keyframe<T>where
T: Freeze,
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§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more