Vixen
02b45cc4
csharp
public sealed class AnimationTransition

A way out of a state: where to, when, how long the crossfade takes.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

Exit time is normalised and conditions are not. A transition with conditions and no exit time fires the moment they hold — which is what a jump wants. One with an exit time fires when the state's own playback passes that fraction — which is what an attack wants, because it must finish its swing. One with both waits for the fraction and the conditions, and one with neither fires immediately, which is how a state that is only a stepping stone is written.

The duration is in seconds and not in fractions. A crossfade is a thing a person perceives, and a fifth of a second is a fifth of a second whether the state it leaves is a half-second attack or a four-second idle. Fixing it as a fraction of the source clip makes the same authored transition feel wrong in two places.

Fields and properties (8)

  • public AnimationState Destination

    Where it goes.

  • public float Duration

    How long the crossfade takes, in seconds. Zero is a cut.

  • public bool HasExitTime

    Whether the source state has to reach ExitTime first.

  • public float ExitTime

    How far through the source state the transition may start, as a fraction of its length.

  • public float Offset

    Where the destination starts, as a fraction of its length.

  • public TransitionInterruption Interruption

    What may cut this transition short.

  • public bool CanTransitionToSelf

    Whether a state may transition to itself, restarting it.

  • public IReadOnlyList<AnimationCondition> Conditions

    What has to hold for it to fire.

Methods (4)

  • public AnimationTransition(AnimationState destination, float duration = 0.2)

    Creates a transition.

  • public AnimationTransition When(AnimationCondition condition)

    Adds a condition.

  • public bool ConditionsHold(AnimationParameters parameters)

    Whether every condition holds. Does not consume triggers — see Consume.

  • public void ConsumeConditions(AnimationParameters parameters)

    Takes whatever the conditions consume. Called only when the transition is taken.

Used by (6)

  • AnimationStateVixen.Animation
  • AnimationStateMachineVixen.Animation
  • StateMachineInstanceVixen.Animation
  • StateMachineTestsVixen.Animation.Tests
  • AnimationGraphCompilerVixen.Editor.AnimationGraph
  • AnimationGraphTestsVixen.Editor.AnimationGraph.Tests