Interpolator::UpdateValue
Defined in:
Updates an interpolator.
C4Time.h
Prototype
float UpdateValue(SubrangeData *subrangeData = nullptr);
Parameters
subrangeData |
An optional pointer to a structure that receives information about what subranges were covered. |
Description
The UpdateValue
function changes the current value of an interpolator based on the current rate, mode, and range. The current mode must include either the kInterpolatorForward
flag or kInterpolatorBackward
flag in order for any change to be made.The current mode may be changed if the current value reaches either the minimum or maximum value of the interpolator's range. For example, if the current mode is
kInterpolateForward
and the current value reaches the maximum value of the range, then the value is pinned at the maximum value and the mode is changed to kInterpolatorStop
.If the interpolator mode is changed to
kInterpolatorStop
, which happens when a non-looping interpolator reaches one of the ends of the current range, then the completion callback function is invoked for the interpolator if one is installed. See the Completable
base class. It is safe to destroy an interpolator from inside the completion callback function.If the current mode includes the
kInterpolatorLoop
flag and the interpolator loops by passing one end of the current range and wrapping around to the other, then the loop callback function is invoked if one is installed. See the Interpolator::SetLoopCallback
function. It is safe to destroy an interpolator from inside the loop callback function.If the
subrangeData
parameter is not nullptr
, then the structure it points to is filled in with information about what ranges of values were covered during the update. For a stopped interpolator, this structure will always indicate no subranges. Otherwise, this structure will contain either one or two subranges depending on whether any looping or oscillation occurred. The minimum value in each subrange always corresponds to the value attained by the interpolator earlier in time. For any subrange over which the interpolator increased in value, the minimum value will be less than or equal to the maximum value, but for any subrange over which the interpolator decreased in value, the minimum value will be greater than or equal to the maximum value.
See Also