Skip to content

AnimationSystem Class

Ticks every AnimatorComponent: evaluates the state machine, advances the animator, and writes the current frame's data to the entity's SpriteComponent (if present). Additional AnimationLayers are then applied in ascending priority order, overwriting whichever properties their AnimationLayerMask allows. Cross-fades initiated via PlayWithCrossFade(string, float, bool) render ghost frames via CrossFadeGhosts so that SpriteRenderingSystem can issue one draw call per concurrent blend. Multiple simultaneous fades (e.g. base + layer) are fully supported.

public class AnimationSystem : Brine2D.ECS.Systems.UpdateSystemBase

Inheritance System.ObjectUpdateSystemBase → AnimationSystem

Remarks

When IsTimeClamped is true (i.e. the game loop detected an unusually large delta), the animation system ticks with zero delta. State machine transitions and the default-state kickoff still execute normally, but no playback time advances and no frame-skip occurs. Animations do not catch up; this is intentional to prevent one-shot events from firing incorrectly on a stalled frame.

Blend tree evaluation order: when both BlendSelector1D and BlendSelector2D are set, only BlendSelector1D is evaluated. Set only the tree you want active, or clear the other to swap between them. The same rule applies per-layer.

Blend trees are evaluated before the animator is ticked so that a clip selected by the tree on the same frame it changes is advanced correctly with no one-frame lag.

Methods
CollectCrossFadeGhost(SpriteComponent, SpriteAnimator, AnimationLayerMask) Builds the ghost entry for any active cross-fade on animator and returns this fader's contribution to the composed incoming-alpha: baseAlpha * crossFadeAlpha when a fade is active, or 1f when no fade is in progress.