12#ifndef MALENA_ANIMATE_H
13#define MALENA_ANIMATE_H
55 std::function<
void()> onComplete = {});
60 std::function<
void()> onComplete = {});
71 std::function<
void(
const T&)> apply,
72 std::function<
void()> onComplete = {})
74 auto tw = std::make_shared<Tweener<T>>(from, to, seconds, ease);
75 tw->onUpdate(std::move(apply));
76 if (onComplete) tw->onComplete(std::move(onComplete));
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 & 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.
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 & operator=(const Animate &)=delete
Animate(const Animate &)=delete
Animate(Positionable *owner)
bool active() const
True while any animation on this object is running.
void cancel()
Cancel every animation on this object (no completion callbacks fire).
static void add(const void *owner, Step step)
Register an animation step owned by owner (used for cancellation).
Trait that provides position, bounds, and animated movement.
Vector2< float > Vector2f
static float EaseOutCubic(float t)