Ignition Common

API Reference

3.5.0

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::KeyFrameKeyFrame (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...
 
void Time (const double _time)
 Set the current time position of the animation. More...
 
double Time () const
 Return the current time position. 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

array of keyframe type alias

Constructor & Destructor Documentation

◆ Animation()

Animation ( const std::string _name,
const double  _length,
const bool  _loop 
)

Constructor.

Parameters
[in]_nameName of the animation, should be unique
[in]_lengthDuration of the animation in seconds
[in]_loopSet to true if the animation should repeat

◆ ~Animation()

virtual ~Animation ( )
virtual

Destructor.

Member Function Documentation

◆ AddTime()

void AddTime ( const double  _time)

Add time to the animation.

Parameters
[in]_timeThe 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]_indexThe 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()

double KeyFramesAtTime ( double  _time,
common::KeyFrame **  _kf1,
common::KeyFrame **  _kf2,
unsigned int &  _firstKeyIndex 
) const
protected

Get the two key frames that bound a time value.

Parameters
[in]_timeThe time in seconds
[out]_kf1Lower bound keyframe that is returned
[out]_kf2Upper bound keyframe that is returned
[out]_firstKeyIndexIndex 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]_lenThe length of the animation in seconds

◆ SetInterpolateX()

void SetInterpolateX ( const bool  _interpolateX)

Set the interpolateX value.

Parameters
[in]_interpolateXThe interpolateX value

◆ Time() [1/2]

void Time ( const double  _time)

Set the current time position of the animation.

Parameters
[in]_timeThe time position in seconds

◆ Time() [2/2]

double Time ( ) const

Return the current time position.

Returns
The time position in seconds

Member Data Documentation

◆ build

bool build
mutableprotected

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: