Struct keyframe::AnimationSequence [−][src]
pub struct AnimationSequence<T> { /* fields omitted */ }
Expand description
A collection of keyframes that can be played back in sequence
Implementations
Inserts a new keyframe into the animation sequence
pub fn insert_many(
&mut self,
keyframes: impl IntoIterator<Item = impl Into<Keyframe<T>>>
) -> Result<(), AnimationSequenceError>
pub fn insert_many(
&mut self,
keyframes: impl IntoIterator<Item = impl Into<Keyframe<T>>>
) -> Result<(), AnimationSequenceError>
Inserts several keyframes from an iterator all at once. This is faster because sorting only needs to be done after all the keyframes have been inserted.
Removes the keyframe from the sequence at the specified time. Returns true if a keyframe was actually removed
Retains only the keyframes specified by the predicate. Works the same as Vec::retain
.
Returns true only if a keyframe was actually removed.
If this sequence has a keyframe at the exact timestamp
The current pair of keyframes that are being animated (current, next)
Note
The following applies if:
- There are no keyframes in this sequence: (
None
,None
) is returned - The sequence has not reached the first keyframe: (
None
, current) is returned - There is only one keyframe in this sequence and the sequence has reached it: (current,
None
) is returned - The sequence has finished: (current,
None
) is returned
The current value of this sequence, only based on the existing sequence entries.
The current value of this sequence, use the default if necessary.
Advances this sequence by the duration specified.
Returns the remaining time (i.e. the amount that the specified duration went outside the bounds of the total duration of this sequence) after the operation has completed.
A value over 0 indicates the sequence is at the finish point. A value under 0 indicates this sequence is at the start point.
Advances this sequence by the duration specified.
If the duration causes the sequence to go out of bounds it will reverse and return true
.
Advances this sequence by the duration specified.
If the duration causes the sequence to go out of bounds it will wrap around and return true
.
Advances this sequence to the exact timestamp.
Returns the remaining time (i.e. the amount that the specified timestamp went outside the bounds of the total duration of this sequence) after the operation has completed.
A value over 0 indicates the sequence is at the finish point. A value under 0 indicates this sequence is at the start point.
Note
The following applies if:
- The timestamp is negative: the sequence is set to
0.0
- The timestamp is after the duration of the sequence: the sequence is set to
duration()
If this sequence has finished and is at the end.
It can be reset with advance_to(0.0)
.
Consumes this sequence and creates a normalized easing function which controls the 2D curve according to the keyframes in this sequence
Note
This function is only implemented for one-dimensional float types, since each value corresponds to a Y position