FREE TRIAL

|

☀
☾

IAnimation.Update

Update(float)

Called once per frame while the animation is running and provides a percentDone, [0, 1] where 1 == 100%, for the current animation iteration.

Remarks

Update(Single) will be called with a value of 0 at the start and 1 on complete in all scenarios except:

  • If the animation is 0 seconds in duration, percentDone == 0 will not be provided. percentDone == 1 will be provided.
  • If Complete(AnimationHandle) is called before animation starts, percentDone == 0 will not be provided. percentDone == 1 will be provided.
  • If Cancel(AnimationHandle) is called before the animation starts, percentDone == 0 will not be provided.
  • If Cancel(AnimationHandle) is called before the animation completes, percentDone == 1 will not be provided.
Declaration
void Update(float percentDone)
Parameters
Type Name Description
float percentDone

The percent, [0, 1] where 1 == 100%, of the animation that has already run.

Examples
using Nova;
using UnityEngine;

public struct PositionAnimation : IAnimation
{
    public UIBlock BlockToAnimate;

    public Vector3 StartPosition;
    public Vector3 EndPosition;

    public void Update(float percentDone)
    {
        BlockToAnimate.Position.Value = Vector3.Lerp(StartPosition, EndPosition, percentDone);
    }
}
☀
☾
In This Article
Legal EmailContact Github
Copyright © 2022 Supernova Technologies, LLC