Tweeny  3
A Tweening library for modern C++

◆ onSeek() [1/3]

tween<T, Ts...>& onSeek ( typename detail::tweentraits< T, Ts... >::callbackType  callback)

Adds a callback for that will be called when seeking occurs.

You can add as many callbacks as you want. Its arguments types must be equal to the argument types of a tween instance, preceded by a variable of the tween typve. Callbacks can be of any callable type. It will be called via tween::seek() functions. For step callbacks, see tween::onStep().

Keep in mind that the function will be copied into an array, so any variable captured by value will also be copied with it.

If the callback returns false, it will be called next time. If it returns true, it will be removed from the callback queue.

Example:

auto t = t:from(0).to(100).during(100);
// pass a lambda
t.onSeek([](tweeny::tween<int> & t, int v) { printf("%d ", v); });
// pass a functor instance
struct ftor { void operator()(tweeny::tween<int> & t, int v) { printf("%d ", v); } };
t.onSeek(ftor());
Parameters
callbackA callback in with the prototype bool callback(tween<Ts...> & t, Ts...)