Skip to main content

LerpingFloatGetValue

A class in Root.Township, Alta.Utilities.

A float that eases from its current value towards a target over time. The target can be a function, read again each update. Call Update every frame.

Constructors​

MemberWhat it is
LerpingFloatGetValue()Creates a LerpingFloatGetValue with default values.

Fields​

5 private and internal fields
MemberWhat it is
private float currentBacking field for Current.
private Func<float> getTargetFunction giving the target, cleared when the lerp ends.
private float initialValue at the start of the lerp.
private float lerpSpeedDuration of a lerp in seconds, despite the name.
private float progressLerp progress from 0 to 1.

Properties​

MemberWhat it is
float Current { get; }The current value.
bool IsLerping { get; private set; }True while moving towards a target.

Methods​

MemberWhat it is
void Kill()Stops at the current value.
void Lerp(float target, float lerpSpeed)Starts easing to a fixed target over a duration in seconds, or to a target function using the last duration.
void Lerp(Func<float> getTarget)Starts easing to a fixed target over a duration in seconds, or to a target function using the last duration.
void Snap(float newTarget)Jumps straight to a value and stops lerping.
void SnapIfNotLerping(float newTarget)Snaps only if no lerp is running.
void Update()Advances the lerp by the frame time and finishes it once progress reaches 1.
protected float Lerp(float initial, float target, float progress)Starts easing to a fixed target over a duration in seconds, or to a target function using the last duration.

Used in​

Members of other types that take, return or hold a LerpingFloatGetValue: