Manages an animation, which is a collection of keyframes and the ability to interpolate between the keyframes. More...
#include <ignition/common/Animation.hh>
Public Member Functions | |
Animation (const std::string &_name, const double _length, const bool _loop) | |
Constructor. More... | |
virtual | ~Animation () |
Destructor. 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 Types | |
typedef std::vector< common::KeyFrame * > | KeyFrame_V |
array of keyframe type alias More... | |
Protected Member Functions | |
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... | |
Protected Attributes | |
bool | build |
determines if the interpolation splines need building More... | |
KeyFrame_V | keyFrames |
array of key frames More... | |
double | length |
animation duration More... | |
bool | loop |
true if animation repeats More... | |
std::string | name |
animation name More... | |
double | timePos |
current time position More... | |
Detailed Description
Manages an animation, which is a collection of keyframes and the ability to interpolate between the keyframes.
Member Typedef Documentation
◆ KeyFrame_V
|
protected |
array of keyframe type alias
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
◆ ~Animation()
|
virtual |
Destructor.
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
◆ 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
Member Data Documentation
◆ build
|
mutableprotected |
determines if the interpolation splines need building
◆ keyFrames
|
protected |
array of key frames
◆ length
|
protected |
animation duration
◆ loop
|
protected |
true if animation repeats
◆ name
|
protected |
animation name
◆ timePos
|
protected |
current time position
The documentation for this class was generated from the following file: