Animation Class Reference
Manages an animation, which is a collection of keyframes and the ability to interpolate between the keyframes. More...
#include <gz/common/Animation.hh>
Public Member Functions | |
Animation (const std::string &_name, const double _length, const bool _loop) | |
Constructor. More... | |
void | AddTime (const double _time) |
Add time to the animation. More... | |
bool | InterpolateX () const |
Return the interpolateX value. More... | |
common::KeyFrame * | KeyFrame (const unsigned int _index) const |
Get a key frame using an index value. More... | |
unsigned int | KeyFrameCount () const |
Return the number of key frames in the animation. More... | |
double | Length () const |
Return the duration of the animation. More... | |
void | Length (const double _len) |
Set the duration of the animation. More... | |
void | SetInterpolateX (const bool _interpolateX) |
Set the interpolateX value. More... | |
double | Time () const |
Return the current time position. More... | |
void | Time (const double _time) |
Set the current time position of the animation. More... | |
Protected Member Functions | |
template<typename KeyFrameType > | |
KeyFrameType * | CreateKeyFrame (const double _time) |
Create a keyframe at the given time. More... | |
double | KeyFramesAtTime (double _time, common::KeyFrame **_kf1, common::KeyFrame **_kf2, unsigned int &_firstKeyIndex) const |
Get the two key frames that bound a time value. More... | |
Detailed Description
Manages an animation, which is a collection of keyframes and the ability to interpolate between the keyframes.
Constructor & Destructor Documentation
◆ Animation()
Animation | ( | const std::string & | _name, |
const double | _length, | ||
const bool | _loop | ||
) |
Constructor.
- Parameters
-
[in] _name Name of the animation, should be unique [in] _length Duration of the animation in seconds [in] _loop Set to true if the animation should repeat
Member Function Documentation
◆ AddTime()
void AddTime | ( | const double | _time | ) |
Add time to the animation.
- Parameters
-
[in] _time The amount of time to add in seconds
◆ CreateKeyFrame()
|
protected |
Create a keyframe at the given time.
- Parameters
-
[in] _time Time at which to create the keyframe
- Returns
- Pointer to the new keyframe
◆ InterpolateX()
bool InterpolateX | ( | ) | const |
Return the interpolateX value.
- Returns
- The interpolateX value
◆ KeyFrame()
common::KeyFrame* KeyFrame | ( | const unsigned int | _index | ) | const |
Get a key frame using an index value.
- Parameters
-
[in] _index The index of the key frame
- Returns
- A pointer the keyframe, NULL if the _index is invalid
◆ KeyFrameCount()
unsigned int KeyFrameCount | ( | ) | const |
Return the number of key frames in the animation.
- Returns
- The number of keyframes
◆ KeyFramesAtTime()
|
protected |
Get the two key frames that bound a time value.
- Parameters
-
[in] _time The time in seconds [out] _kf1 Lower bound keyframe that is returned [out] _kf2 Upper bound keyframe that is returned [out] _firstKeyIndex Index of the lower bound key frame
- Returns
- The time between the two keyframe
◆ Length() [1/2]
double Length | ( | ) | const |
Return the duration of the animation.
- Returns
- Duration of the animation in seconds
◆ Length() [2/2]
void Length | ( | const double | _len | ) |
Set the duration of the animation.
- Parameters
-
[in] _len The length of the animation in seconds
◆ SetInterpolateX()
void SetInterpolateX | ( | const bool | _interpolateX | ) |
Set the interpolateX value.
- Parameters
-
[in] _interpolateX The interpolateX value
◆ Time() [1/2]
double Time | ( | ) | const |
Return the current time position.
- Returns
- The time position in seconds
◆ Time() [2/2]
void Time | ( | const double | _time | ) |
Set the current time position of the animation.
- Parameters
-
[in] _time The time position in seconds
The documentation for this class was generated from the following file: