Antkeeper  0.0.1
Public Types | Public Member Functions | List of all members
animation< T > Class Template Reference

Keyframe animation. More...

#include <animation.hpp>

Inheritance diagram for animation< T >:
animation_base

Public Types

typedef animation_channel< T > channel
 Channel for this animation type. More...
 
typedef channel::keyframe keyframe
 
typedef std::decay< std::function< T(const T &, const T &, float)> >::type interpolator_type
 Interpolator function type. More...
 

Public Member Functions

 animation ()
 Creates an animation. More...
 
virtual void advance (float dt)
 Advances the animation position (t) by dt. More...
 
channeladd_channel (int id)
 Adds a channel to the animation. More...
 
void remove_channel (int id)
 Removes a channel from the animation. More...
 
void remove_channels ()
 Removes all channels from the animation. More...
 
void set_interpolator (interpolator_type interpolator)
 Sets the frame interpolator function object. More...
 
void set_frame_callback (std::function< void(int, const T &)> callback)
 Sets the callback that's executed on each frame of animation. More...
 
const channelget_channel (int id) const
 Returns the channel with the specified ID. More...
 
channelget_channel (int id)
 Returns the channel with the specified ID. More...
 
virtual float get_duration () const
 Returns the duration of the animation. More...
 
- Public Member Functions inherited from animation_base
 animation_base ()
 
void seek (float t)
 Sets the animation position to t. More...
 
void rewind ()
 Sets the animation position to 0.0. More...
 
void loop (bool enabled)
 Enables or disables looping of the animation. More...
 
void pause ()
 Pauses the animation. More...
 
void play ()
 Plays the animation. More...
 
void stop ()
 Stops the animation, rewinds it, and resets the loop count. More...
 
void set_speed (float speed)
 Sets the speed of the animation. More...
 
bool is_looped () const
 Returns true if looping of the animation is enabled, false otherwise. More...
 
bool is_paused () const
 Returns true if the animation is paused, false otherwise. More...
 
bool is_stopped () const
 Returns true if the animation is stopped, false otherwise. More...
 
float get_position () const
 Returns the current position in time of the animation. More...
 
int get_loop_count () const
 Returns the current loop count of the animation. More...
 
void set_start_callback (std::function< void()> callback)
 Sets the callback that's executed when the animation is started from a stopped state. More...
 
void set_end_callback (std::function< void()> callback)
 Sets the callback that's executed when a non-looped animation has finished. More...
 
void set_loop_callback (std::function< void(int)> callback)
 Sets the callback that's executed when the animation loops. More...
 

Additional Inherited Members

- Protected Attributes inherited from animation_base
bool looped
 
int loop_count
 
bool paused
 
bool stopped
 
float position
 
float speed
 
std::function< void()> start_callback
 
std::function< void()> end_callback
 
std::function< void(int)> loop_callback
 

Detailed Description

template<typename T>
class animation< T >

Keyframe animation.

Template Parameters
TAnimated data type.

Definition at line 148 of file animation.hpp.

Member Typedef Documentation

◆ channel

template<typename T >
typedef animation_channel<T> animation< T >::channel

Channel for this animation type.

Definition at line 152 of file animation.hpp.

◆ interpolator_type

template<typename T >
typedef std::decay<std::function<T(const T&, const T&, float)> >::type animation< T >::interpolator_type

Interpolator function type.

Definition at line 158 of file animation.hpp.

◆ keyframe

template<typename T >
typedef channel::keyframe animation< T >::keyframe

Definition at line 155 of file animation.hpp.

Constructor & Destructor Documentation

◆ animation()

template<typename T >
animation< T >::animation

Creates an animation.

Definition at line 218 of file animation.hpp.

Member Function Documentation

◆ add_channel()

template<typename T >
animation< T >::channel * animation< T >::add_channel ( int  id)

Adds a channel to the animation.

Parameters
idID of the channel.
Returns
Added or pre-existing channel.

Definition at line 317 of file animation.hpp.

◆ advance()

template<typename T >
void animation< T >::advance ( float  dt)
virtual

Advances the animation position (t) by dt.

Parameters
dtDelta time by which the animation position will be advanced.

Implements animation_base.

Definition at line 224 of file animation.hpp.

◆ get_channel() [1/2]

template<typename T >
animation< T >::channel * animation< T >::get_channel ( int  id)

Returns the channel with the specified ID.

Parameters
idID of the channel to get.

Definition at line 363 of file animation.hpp.

◆ get_channel() [2/2]

template<typename T >
const animation< T >::channel * animation< T >::get_channel ( int  id) const

Returns the channel with the specified ID.

Parameters
idID of the channel to get.

Definition at line 351 of file animation.hpp.

◆ get_duration()

template<typename T >
float animation< T >::get_duration
virtual

Returns the duration of the animation.

Implements animation_base.

Definition at line 375 of file animation.hpp.

◆ remove_channel()

template<typename T >
void animation< T >::remove_channel ( int  id)

Removes a channel from the animation.

Parameters
idID of the channel to remove.

Definition at line 323 of file animation.hpp.

◆ remove_channels()

template<typename T >
void animation< T >::remove_channels

Removes all channels from the animation.

Definition at line 333 of file animation.hpp.

◆ set_frame_callback()

template<typename T >
void animation< T >::set_frame_callback ( std::function< void(int, const T &)>  callback)

Sets the callback that's executed on each frame of animation.

Parameters
callbackFrame callback which receives the index of an animation channel and value of an interpolated frame.

Definition at line 345 of file animation.hpp.

◆ set_interpolator()

template<typename T >
void animation< T >::set_interpolator ( interpolator_type  interpolator)

Sets the frame interpolator function object.

Parameters
interpolatorFrame interpolator function object.

Definition at line 339 of file animation.hpp.


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