![]() |
vkmEngine 1.0.0
A C++ game engine · vkmengine.com
|
Keyframes of type T sorted by time, sampled through an easing curve. More...
#include <animation_track.h>
Public Member Functions | |
| AnimationTrack (Easing easing) | |
Construct a track that interpolates with easing. | |
| size_t | addKeyframe (float time, const T &value) |
Add a keyframe at time. | |
| void | setKeyframe (float time, const T &value) |
Set the value at time, replacing any keyframe already there. | |
| void | removeKeyframe (size_t index) |
Remove the keyframe at index; out of range is a no-op. | |
| void | setKeyframeValue (size_t index, const T &value) |
Replace the value of the keyframe at index; out of range is a no-op. | |
| size_t | setKeyframeTime (size_t index, float time) |
Move the keyframe at index to time. | |
| void | setEasing (Easing easing) |
| Choose the curve this track eases its interpolation with. | |
| T | getValue (float time) const |
Sample the track at time. | |
| float | getDuration () const |
| The track's length. | |
| Easing | getEasing () const |
| The curve this track eases with. | |
| const std::vector< float > & | getTimes () const |
| The keyframe times, ascending. | |
| const std::vector< T > & | getValues () const |
| The keyframe values, parallel to getTimes. | |
Static Public Attributes | |
| static constexpr float | SAME_INSTANT_SECONDS = 1e-4f |
| Two keyframe times closer than this, in seconds, are one instant. | |
Keyframes of type T sorted by time, sampled through an easing curve.
T is any type glm::mix accepts.
| T | Value type, e.g. glm::vec3 or float. |
|
inlineexplicit |
Construct a track that interpolates with easing.
| easing | The curve; see setEasing. |
|
inline |
Add a keyframe at time.
A keyframe at a time already held is added beside it, not replacing it; setKeyframe() re-keys.
| time | Time in the unit the track is read at, usually seconds. |
| value | Value at that time. |
|
inline |
Set the value at time, replacing any keyframe already there.
Matches approximately, so re-keying an instant leaves no zero-length segment.
| time | Time to key at. |
| value | Value at that time. |
|
inline |
Remove the keyframe at index; out of range is a no-op.
| index | Keyframe to remove. |
|
inline |
Replace the value of the keyframe at index; out of range is a no-op.
| index | Keyframe to change. |
| value | New value. |
|
inline |
Move the keyframe at index to time.
The track stays sorted, so the keyframe's index may change.
| index | Keyframe to move; out of range is a no-op. |
| time | Time to move it to. |
index when there was nothing to move.
|
inline |
Choose the curve this track eases its interpolation with.
| easing | The curve, such as Easing::EaseInOutSine. |
|
inline |
Sample the track at time.
An empty track returns T{}; outside the keyframe range the nearest end value holds.
| time | Time in the track's unit. |
|
inline |
The track's length.
|
inline |
The curve this track eases with.
|
inline |
The keyframe times, ascending.
|
inline |
The keyframe values, parallel to getTimes.