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

## onStep() [3/3]

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

Adds a callback that will be called when stepping occurs, accepting only the tween values.

You can add as many callbacks as you want. It must receive the tween values as an argument. Callbacks can be of any callable type. It will only be called via tween::step() functions. For seek callbacks, see tween::onSeek().

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 = tweeny:from(0).to(100).during(100);
// pass a lambda
t.onStep([](int v) { printf("%d ", v); return false; });
// pass a functor instance
struct ftor { void operator()(int x) { printf("%d ", x); return false; } };
t.onStep(ftor());

See also
  step
  seek
  onSeek

Parameters

  callback | A callback in the form `bool f(Ts...)`