pub struct AnimationSequence<T> { /* private fields */ }
Expand description

A collection of keyframes that can be played back in sequence

Implementations

Creates a new empty animation sequence

Inserts a new keyframe into the animation sequence

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

Removes all keyframes from this sequence

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 number of keyframes in this sequence

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()

The length in seconds of this sequence

The current progression of this sequence in seconds

The current progression of this sequence as a percentage

If this sequence has finished and is at the end. It can be reset with advance_to(0.0).

Reverses the order of all keyframes in this sequence

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

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Returns the “default value” for a type. Read more

Creates a new animation sequence from a vector of keyframes

Creates a new animation sequence from an iterator

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.