Skip to main content

AnimatedFloatLerp

A class in Root.Township, Alta.Networking.Animation.

A synced animator float that clients ease towards the received value instead of jumping to it. Big changes past snapThreshold snap straight away.

Constructors​

MemberWhat it is
AnimatedFloatLerp(string name)Creates an AnimatedFloatLerp from name.

Fields​

4 private and internal fields
MemberWhat it is
private bool isLerpingTrue while the shown value is still moving towards the target.
private float lerpProgressFraction of the remaining gap closed per Lerp call. Default 0.1.
private float snapThresholdChange size at or above which the value snaps instead of easing. Off when 0 or less (default -1).
private float targetThe value being eased towards, and the one that gets synced.

Properties​

MemberWhat it is
override float Value { get; set; }The target value. Setting it starts easing, or snaps when the change is tiny or over the snap threshold, and marks it changed for syncing.

Methods​

MemberWhat it is
void Lerp()Moves the shown value a step towards the target and writes it to the animator. NetworkAnimator calls it each update.
protected override void Serialize(Stream stream)Sends the target value. Clients start easing towards it, or snap if the change is over the snap threshold.
protected override void Update()Writes the current eased value to the animator parameter.

Used in​

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