Interpolator::SetLoopCallback
Defined in:
Sets the loop callback function for an interpolator.
C4Time.h
Prototype
void SetLoopCallback(LoopCallback *callback, void *cookie = nullptr);
Parameters
callback |
The new loop callback function. |
cookie |
The cookie that is passed to the loop callback function. |
Description
The SetLoopCallback
function installs a callback function that is called when a looping interpolator reaches the end of one cycle and loops. An interpolator is looping if its current mode includes the kInterpolatorLoop
flag. The loop callback function specified by the callback
parameter should point to a function having the following prototype.
typedef void LoopCallback(Interpolator *, void *);
cookie
parameter is passed as the second parameter.An interpolator initially has no loop callback function. If the
callback
parameter is nullptr
, then any existing loop callback function is removed from the interpolator.If an interpolator's mode is equal to
kInterpolatorForward | kInterpolatorLoop
, then the loop callback function is called when the current value reaches the maximum value of the interpolator's range. If an interpolator's mode is equal to kInterpolatorBackward | kInterpolatorLoop
, then the loop callback function is called when the current value reaches the minimum value of the interpolator's range. If the kInterpolatorOscillate
flag is set in the current mode, then the loop callback function is called only when the current value is decreasing and reaches the minimum value of the interpolator's range.It is safe to destroy an interpolator from inside the loop callback function.
See Also