Loading...
Searching...
No Matches

backward
direction
duration
during
forward
from
jump
onSeek
onSeek
onSeek
onStep
onStep
onStep
peek
peek
peek
point
progress
seek
seek
seek
step
step
step
to
tween
via
via

## onSeek() [3/3]

template<typename T , typename... Ts>

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

Adds a callback for that will be called when seeking occurs, accepting only the tween.

You can add as many callbacks as you want. It must receive the tween as an argument. 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 again.

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) { printf("%d ", t.value()); return false; });
// pass a functor instance
struct ftor { void operator()(tweeny::tween<int> & t) { printf("%d ", t.value()); return false; } };
t.onSeek(ftor());
tweeny::tween::from
static tween< T, Ts... > from(T t, Ts... vs)
Instantiates a tween from a starting currentPoint.
tweeny::tween::onSeek
tween< T, Ts... > & onSeek(typename detail::tweentraits< T, Ts... >::callbackType callback)
Adds a callback for that will be called when seeking occurs.
tweeny::tween
The tween class is the core class of tweeny. It controls the interpolation steps, easings and duratio...
Definition tween.h:48

Parameters

  callback | A callback in the form `bool f(tween<Ts...> & t)`