Antkeeper
0.0.1
|
Keyframe animation. More...
#include <animation.hpp>
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... | |
channel * | add_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 channel * | get_channel (int id) const |
Returns the channel with the specified ID. More... | |
channel * | get_channel (int id) |
Returns the channel with the specified ID. More... | |
virtual float | get_duration () const |
Returns the duration of the animation. More... | |
![]() | |
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 | |
![]() | |
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 |
Keyframe animation.
T | Animated data type. |
Definition at line 148 of file animation.hpp.
typedef animation_channel<T> animation< T >::channel |
Channel for this animation type.
Definition at line 152 of file animation.hpp.
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.
typedef channel::keyframe animation< T >::keyframe |
Definition at line 155 of file animation.hpp.
Creates an animation.
Definition at line 218 of file animation.hpp.
Adds a channel to the animation.
id | ID of the channel. |
Definition at line 317 of file animation.hpp.
|
virtual |
Advances the animation position (t) by dt
.
dt | Delta time by which the animation position will be advanced. |
Implements animation_base.
Definition at line 224 of file animation.hpp.
Returns the channel with the specified ID.
id | ID of the channel to get. |
Definition at line 363 of file animation.hpp.
Returns the channel with the specified ID.
id | ID of the channel to get. |
Definition at line 351 of file animation.hpp.
|
virtual |
Returns the duration of the animation.
Implements animation_base.
Definition at line 375 of file animation.hpp.
void animation< T >::remove_channel | ( | int | id | ) |
Removes a channel from the animation.
id | ID of the channel to remove. |
Definition at line 323 of file animation.hpp.
void animation< T >::remove_channels |
Removes all channels from the animation.
Definition at line 333 of file animation.hpp.
void animation< T >::set_frame_callback | ( | std::function< void(int, const T &)> | callback | ) |
Sets the callback that's executed on each frame of animation.
callback | Frame callback which receives the index of an animation channel and value of an interpolated frame. |
Definition at line 345 of file animation.hpp.
void animation< T >::set_interpolator | ( | interpolator_type | interpolator | ) |
Sets the frame interpolator function object.
interpolator | Frame interpolator function object. |
Definition at line 339 of file animation.hpp.