AnimationTransition Class
Represents a single conditional transition between two animation states.
public sealed record AnimationTransition : System.IEquatable<Brine2D.Animation.AnimationTransition>
Inheritance System.Object → AnimationTransition
Implements System.IEquatable<AnimationTransition>
| Constructors | |
|---|---|
| AnimationTransition(string, string, Func<bool>, bool, float, float, float, bool, int, bool) | Represents a single conditional transition between two animation states. |
| Properties | |
|---|---|
| CanInterrupt | Whether this transition can interrupt a non-looping clip mid-play. |
| Condition | The condition that must be true for the transition to fire. When OnComplete is true, AddOnCompleteTransition(string, string, Func<bool>, float, int, bool) wraps this with a guaranteed () => true fallback — pass your own condition to make an on-complete transition conditional. |
| CrossFadeDuration | When greater than zero the state machine fires PlayWithCrossFade(string, float, bool) instead of Play(string, bool), blending from the outgoing to the incoming clip over this many seconds. Zero means hard cut. |
| From | The animation name this transition originates from, or null for AnyState. |
| MinNormalizedTime | Minimum normalized playback position [0, 1] the source animation must have reached before this transition can fire. Zero means no minimum. Use this for exit-time transitions — for example, 0.8 means "don't allow this transition until the clip is 80% complete". |
| MinStateDuration | Minimum time in seconds the source animation must have been playing before this transition can fire. Zero means no minimum. |
| OnComplete | When true, this transition is evaluated only after a non-looping source clip reaches its natural end. Condition is still evaluated — use AddOnCompleteTransition(string, string, Func<bool>, float, int, bool) with null condition for an unconditional on-complete transition. |
| OnFired | Optional action invoked immediately after this transition fires (after the new clip has started). Use this to perform side-effects that should only happen when the transition actually fires — for example, consuming an AnimationParameters trigger without risking early consumption from short-circuit evaluation in Condition. See AddTriggerTransition(string, string, AnimationParameters, string, bool, float, float, float, int, bool) for a ready-made helper that wires this up automatically for trigger-based transitions. |
| Priority | Evaluation order within the same transition list. Higher values are evaluated first. Transitions with the same priority are evaluated in insertion order. Defaults to 0. Use positive values for high-priority overrides and negative values for low-priority fallbacks. |
| RestartSelf | When true and To == From (or an AnyState transition whose target is currently active), the transition is allowed to fire and restarts the clip from the beginning instead of being silently skipped. Defaults to false. |
| To | The animation name to transition to. |