![]() |
Gamedev Framework (gf)
0.10.0
A C++14 framework for 2D games
|
An interpolation between two values. More...
#include <gf/Tween.h>
Public Types | |
using | Setter = std::function< void(const T &)> |
A setter function. More... | |
Public Member Functions | |
Tween (T origin, T target, Setter setter, Time duration, Easing easing=Ease::linear) | |
Constructor with a setter. More... | |
Tween (T origin, T target, T &value, Time duration, Easing easing=Ease::linear) | |
Constructor with a reference. More... | |
void | setOrigin (T origin) |
Change the origin of the tween. More... | |
constexpr T | getOrigin () const noexcept |
Get the origin of the tween. More... | |
void | setTarget (T target) |
Change the target of the tween. More... | |
constexpr T | getTarget () const noexcept |
Get the target of the tween. More... | |
void | setDuration (Time duration) |
Change the duration of the tween. More... | |
constexpr Time | getDuration () const noexcept |
Get the duration of the tween. More... | |
T | getValue () const |
Get the current value of the tween. More... | |
bool | isFinished () const |
Check if the tween is finished. More... | |
void | update (Time time) |
Update the tween. More... | |
void | restart () |
Restart the tween. More... | |
An interpolation between two values.
A setter function.
|
inline |
Constructor with a setter.
origin | The origin value |
target | The target value |
setter | The setter |
duration | The duration of the tween |
easing | The easing for the interpolation |
|
inline |
Constructor with a reference.
origin | The origin value |
target | The target value |
value | A reference on the value |
duration | The duration of the tween |
easing | The easing for the interpolation |
Get the duration of the tween.
Get the origin of the tween.
Get the target of the tween.
Get the current value of the tween.
Check if the tween is finished.
Change the duration of the tween.
duration | The new duration |
Change the origin of the tween.
origin | The new origin |
Change the target of the tween.
target | The new target |