Abstract base class for keyframe animations.
More...
#include <animation.hpp>
|
| animation_base () |
|
virtual void | advance (float dt)=0 |
| Advances the animation position (t) by dt . More...
|
|
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...
|
|
virtual float | get_duration () const =0 |
| Returns the duration 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...
|
|
Abstract base class for keyframe animations.
Definition at line 32 of file animation.hpp.
◆ animation_base()
animation_base::animation_base |
( |
| ) |
|
◆ advance()
virtual void animation_base::advance |
( |
float |
dt | ) |
|
|
pure virtual |
Advances the animation position (t) by dt
.
- Parameters
-
dt | Delta time by which the animation position will be advanced. |
Implemented in animation< T >, and animation< float >.
◆ get_duration()
virtual float animation_base::get_duration |
( |
| ) |
const |
|
pure virtual |
◆ get_loop_count()
int animation_base::get_loop_count |
( |
| ) |
const |
|
inline |
Returns the current loop count of the animation.
Definition at line 137 of file animation.hpp.
◆ get_position()
float animation_base::get_position |
( |
| ) |
const |
|
inline |
Returns the current position in time of the animation.
Definition at line 132 of file animation.hpp.
◆ is_looped()
bool animation_base::is_looped |
( |
| ) |
const |
|
inline |
Returns true
if looping of the animation is enabled, false
otherwise.
Definition at line 117 of file animation.hpp.
◆ is_paused()
bool animation_base::is_paused |
( |
| ) |
const |
|
inline |
Returns true
if the animation is paused, false
otherwise.
Definition at line 122 of file animation.hpp.
◆ is_stopped()
bool animation_base::is_stopped |
( |
| ) |
const |
|
inline |
Returns true
if the animation is stopped, false
otherwise.
Definition at line 127 of file animation.hpp.
◆ loop()
void animation_base::loop |
( |
bool |
enabled | ) |
|
Enables or disables looping of the animation.
Definition at line 44 of file animation.cpp.
◆ pause()
void animation_base::pause |
( |
| ) |
|
◆ play()
void animation_base::play |
( |
| ) |
|
◆ rewind()
void animation_base::rewind |
( |
| ) |
|
Sets the animation position to 0.0
.
Definition at line 39 of file animation.cpp.
◆ seek()
void animation_base::seek |
( |
float |
t | ) |
|
Sets the animation position to t
.
- Parameters
-
t | Position in time to which the animation position will be set. |
Definition at line 34 of file animation.cpp.
◆ set_end_callback()
void animation_base::set_end_callback |
( |
std::function< void()> |
callback | ) |
|
Sets the callback that's executed when a non-looped animation has finished.
Definition at line 87 of file animation.cpp.
◆ set_loop_callback()
void animation_base::set_loop_callback |
( |
std::function< void(int)> |
callback | ) |
|
Sets the callback that's executed when the animation loops.
- Parameters
-
callback | Loop callback function which is passed the current loop count. |
Definition at line 92 of file animation.cpp.
◆ set_speed()
void animation_base::set_speed |
( |
float |
speed | ) |
|
Sets the speed of the animation.
- Parameters
-
Definition at line 77 of file animation.cpp.
◆ set_start_callback()
void animation_base::set_start_callback |
( |
std::function< void()> |
callback | ) |
|
Sets the callback that's executed when the animation is started from a stopped state.
Definition at line 82 of file animation.cpp.
◆ stop()
void animation_base::stop |
( |
| ) |
|
Stops the animation, rewinds it, and resets the loop count.
Definition at line 69 of file animation.cpp.
◆ end_callback
std::function<void()> animation_base::end_callback |
|
protected |
◆ loop_callback
std::function<void(int)> animation_base::loop_callback |
|
protected |
◆ loop_count
int animation_base::loop_count |
|
protected |
◆ looped
bool animation_base::looped |
|
protected |
◆ paused
bool animation_base::paused |
|
protected |
◆ position
float animation_base::position |
|
protected |
◆ speed
float animation_base::speed |
|
protected |
◆ start_callback
std::function<void()> animation_base::start_callback |
|
protected |
◆ stopped
bool animation_base::stopped |
|
protected |
The documentation for this class was generated from the following files: