Skip to content

AnimationTransition(string, string, Func, bool, float, float, float, bool, int, bool) Constructor

Definition

Namespace: Brine2D.Animation

Represents a single conditional transition between two animation states.

public AnimationTransition(string? From, string To, System.Func<bool> Condition, bool CanInterrupt, float CrossFadeDuration=0f, float MinStateDuration=0f, float MinNormalizedTime=0f, bool OnComplete=false, int Priority=0, bool RestartSelf=false);

Parameters

From System.String

The animation name this transition originates from, or null for AnyState.

To System.String

The animation name to transition to.

Condition System.Func<System.Boolean>

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.

CanInterrupt System.Boolean

Whether this transition can interrupt a non-looping clip mid-play.

CrossFadeDuration System.Single

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.

MinStateDuration System.Single

Minimum time in seconds the source animation must have been playing before this transition can fire. Zero means no minimum.

MinNormalizedTime System.Single

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".

OnComplete System.Boolean

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.

Priority System.Int32

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 System.Boolean

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.