Classes:DynamicValueInterpolator
DynamicValueInterpolator is a UI-scoped class usually utilized by ZScript status bars (classes based on BaseStatusbar). It allows for gradual change of a value, which can be used for something like a health indicator lerping over a few tics instead of changing its value instantly, or a similar effect with a graphical element.
Note: This feature is for ZScript only. |
Fields
- int mCurrentValue - The current value contained in the interpolator
- int mMinChange - The minimum change from from the original value to the target value per interpolator's update
- int mMaxChange - The maximum value from from the original value to the target value per interpolator's update
- double mChangeFactor - The change factor
Methods
Static
static DynamicValueInterpolator Create(int startval, double changefactor, int minchange, int maxchange)
This function instantiates a new interpolator. It should be cast to a local field in the HUD (or other UI) class in order to interact with it.
Arguments:
- int startval - The original value
- double changefactor - The fraction of the amount between the current value and the target value the interpolator should cover per one Update() call
- int minchange - The minimum change from from the original value to the target value per interpolator's update
- int maxchange - The maximum value from from the original value to the target value per interpolator's update
Dynamic
void Update(int destvalue) - Updates the interpolator, setting a new target value for it to move towards from the current value. The new target value is defined by the destvalue argument.
int GetValue() - Returns the current value in the interpolator (contained in the mCurrentValue field).
void Reset (int value) - Sets the interpolator's current value to value.