Fluent animation controller bound to one object.
More...
#include <Malena/Animation/Animate.h>
|
| | Animate (const Animate &)=delete |
| | Animate (Positionable *owner) |
| | ~Animate () |
| bool | active () const |
| | True while any animation on this object is running.
|
| void | cancel () |
| | Cancel every animation on this object (no completion callbacks fire).
|
| Animate & | move (sf::Vector2f to, float seconds, Easing::Fn ease=Easing::EaseOutCubic, std::function< void()> onComplete={}) |
| | Animate the owner's position to to over seconds.
|
| Animate & | moveBy (sf::Vector2f delta, float seconds, Easing::Fn ease=Easing::EaseOutCubic, std::function< void()> onComplete={}) |
| | Animate the owner's position by a relative delta over seconds.
|
| Animate & | operator= (const Animate &)=delete |
| template<class T> |
| Animate & | value (T from, T to, float seconds, Easing::Fn ease, std::function< void(const T &)> apply, std::function< void()> onComplete={}) |
| | Animate an arbitrary value and deliver it through apply.
|
Fluent animation controller bound to one object.
comp.animate().moveBy({0.f, -20.f}, 0.2f);
[&](
const sf::Color& c){ shape.setFillColor(c); });
static float Linear(float t)
static float EaseOutCubic(float t)
A new move / moveBy cancels this object's previous animations first, so position tweens never fight. Animations are automatically cancelled when the owning object is destroyed.
Definition at line 43 of file Animate.h.
◆ Animate() [1/2]
◆ ~Animate()
| ml::Animate::~Animate |
( |
| ) |
|
|
inline |
◆ Animate() [2/2]
| ml::Animate::Animate |
( |
const Animate & | | ) |
|
|
delete |
◆ active()
| bool ml::Animate::active |
( |
| ) |
const |
|
nodiscard |
True while any animation on this object is running.
◆ cancel()
| void ml::Animate::cancel |
( |
| ) |
|
Cancel every animation on this object (no completion callbacks fire).
◆ move()
Animate the owner's position to to over seconds.
◆ moveBy()
Animate the owner's position by a relative delta over seconds.
◆ operator=()
◆ value()
template<class T>
| Animate & ml::Animate::value |
( |
T | from, |
|
|
T | to, |
|
|
float | seconds, |
|
|
Easing::Fn | ease, |
|
|
std::function< void(const T &)> | apply, |
|
|
std::function< void()> | onComplete = {} ) |
|
inline |
Animate an arbitrary value and deliver it through apply.
The engine is type-generic (float / sf::Vector2f / sf::Color); the caller supplies the setter, so this drives color, scale, opacity, scroll — anything lerpable — without Animate needing to know the property.
Definition at line 70 of file Animate.h.
The documentation for this class was generated from the following file: