Gazebo Common

API Reference

5.6.0

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::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...
 
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]_nameName of the animation, should be unique
[in]_lengthDuration of the animation in seconds
[in]_loopSet to true if the animation should repeat

Member Function Documentation

◆ AddTime()

void AddTime ( const double  _time)

Add time to the animation.

Parameters
[in]_timeThe amount of time to add in seconds

◆ CreateKeyFrame()

KeyFrameType* CreateKeyFrame ( const double  _time)
protected

Create a keyframe at the given time.

Parameters
[in]_timeTime 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]_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]

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]_timeThe time position in seconds

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