AnimancerState.

Duration Property

Summary

The number of seconds the animation will take to play fully at its current Animancer.AnimancerNodeBase.EffectiveSpeed.
Assembly
Animancer.dll
Namespace
Animancer
Containing Type
AnimancerState

Syntax

public float Duration { get; set; }

Remarks

For the time remaining from now until it reaches the end, use Animancer.AnimancerState.RemainingDuration instead.

Setting this value modifies the Animancer.AnimancerNodeBase.Speed, not the Animancer.AnimancerState.Length.

Animancer Lite doesn't allow this value to be changed in runtime builds.

Example:
 void PlayAnimation(AnimancerComponent animancer, AnimationClip clip)
 {
     var state = animancer.Play(clip);

     state.Duration = 1;// Play fully in 1 second.
     state.Duration = 2;// Play fully in 2 seconds.
     state.Duration = 0.5f;// Play fully in half a second.
     state.Duration = -1;// Play backwards fully in 1 second.
     state.NormalizedTime = 1; state.Duration = -1;// Play backwards from the end in 1 second.
 }

Value

Type Description
float