##

Animation Class Reference
Common

Manages an animation, which is a collection of keyframes and the ability to interpolate between the keyframes. More...

`#include <common/common.hh>`

Inherited by NumericAnimation, and PoseAnimation.

## Public Member Functions

| Animation (const std::string &_name, double _length, bool _loop)
| Constructor. More...
virtual | ~Animation ()
| Destructor. More...
void | AddTime (double _time)
| Add time to the animation. More...
KeyFrame * | GetKeyFrame (unsigned int _index) const
| Get a key frame using an index value. More...
unsigned int | GetKeyFrameCount () const
| Return the number of key frames in the animation. More...
double | GetLength () const
| Return the duration of the animation. More...
double | GetTime () const
| Return the current time position. More...
void | SetLength (double _len)
| Set the duration of the animation. More...
void | SetTime (double _time)
| Set the current time position of the animation. More...

## Protected Types

typedef std::vector< KeyFrame * > | KeyFrame_V
| array of keyframe type alias More...

## Protected Member Functions

double | GetKeyFramesAtTime (double _time, KeyFrame **_kf1, 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

typedef std::vector<KeyFrame*> KeyFrame_V

protected

array of keyframe type alias

## Constructor & Destructor Documentation

## Animation()

Animation | ( | const std::string & | _name,
|  | double | _length,
|  | 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 ~Animation | ( |  | ) |

virtual

Destructor.

## Member Function Documentation

## AddTime()

void AddTime | ( | double | _time | ) |

Add time to the animation.

Parameters

  [in] | _time | The amount of time to add in seconds

## GetKeyFrame()

KeyFrame* GetKeyFrame | ( | 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, nullptr if the _index is invalid

## GetKeyFrameCount()

unsigned int GetKeyFrameCount | ( |  | ) | const

Return the number of key frames in the animation.

Returns
  The number of keyframes

## GetKeyFramesAtTime()

double GetKeyFramesAtTime | ( | double | _time,
|  | KeyFrame ** | _kf1,
|  | KeyFrame ** | _kf2,
|  | unsigned int & | _firstKeyIndex
| ) |  | const

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

## GetLength()

double GetLength | ( |  | ) | const

Return the duration of the animation.

Returns
  Duration of the animation in seconds

## GetTime()

double GetTime | ( |  | ) | const

Return the current time position.

Returns
  The time position in seconds

## SetLength()

void SetLength | ( | double | _len | ) |

Set the duration of the animation.

Parameters

  [in] | _len | The length of the animation in seconds

## SetTime()

void SetTime | ( | double | _time | ) |

Set the current time position of the animation.

Parameters

  [in] | _time | The time position in seconds

## Member Data Documentation

## build

bool build

mutable protected

determines if the interpolation splines need building

## keyFrames

KeyFrame_V keyFrames

protected

array of key frames

## length

double length

protected

animation duration

## loop

bool loop

protected

true if animation repeats

## name

std::string name

protected

animation name

## timePos

double timePos

protected

current time position

The documentation for this class was generated from the following file:

- Animation.hh