Thor's animations are not time based, only the front-end
thor::Animator is. If you read
a bit further, you see I proposed a
std::function<float(float)> which is very generic. Maybe one could build something on top of that.
In Thor, the
concept of an animation is as follows:
void animation(Animated& object, float progress);
This is quite generic, as it allows to animate an object using an arbitrary function that takes a
float in [0,1]. You can use functions, functors,
std::bind, or lambda expressions. Depending on what you need, you can implement an intermediate layer that transforms a progress range to another. For example, playing an animation in reverse can be done in a single line:
auto anim = ...; // animation function satisfying the concept
auto reverse = [anim] (sf::Sprite& s, float pr) { return anim(s, 1.f - pr); };
You might also want to read my
design considerations. Maybe this can inspire you for an API...