Skip to content

AnimationLayer Class

An independent animation track that can run alongside the primary AnimatorComponent animator. Each layer owns its own SpriteAnimator and AnimationStateMachine.

public sealed class AnimationLayer : System.IDisposable

Inheritance System.Object → AnimationLayer

Implements System.IDisposable

Remarks

Layers are applied in ascending Priority order; higher priority wins. By default only Brine2D.Animation.AnimationLayerMask.SourceRect and Brine2D.Animation.AnimationLayerMask.Origin are written. Add Brine2D.Animation.AnimationLayerMask.Texture to Mask if the layer drives a different texture atlas; it is excluded from the default to avoid clobbering the base sprite texture.

Properties
Animator The animator for this layer. Add clips and call Play(string, bool) directly, or configure StateMachine for automatic transitions.
BlendMode Controls how this layer's values are combined with existing sprite values. Defaults to Override.
BlendSelector1D Optional 1D blend tree for this layer.
BlendSelector2D Optional 2D blend tree for this layer. Evaluated automatically each frame by AnimationSystem. When both BlendSelector1D and BlendSelector2D are set, BlendSelector1D is evaluated first.
IsEnabled When false, the system skips this layer entirely each frame.
Mask Controls which SpriteComponent properties this layer writes. Defaults to Default (Brine2D.Animation.AnimationLayerMask.SourceRect | Brine2D.Animation.AnimationLayerMask.Origin). Add Brine2D.Animation.AnimationLayerMask.Texture when this layer drives a different texture atlas, Brine2D.Animation.AnimationLayerMask.Tint for tint effects, etc.
Name Human-readable name for debugging.
Parameters Shared parameter store for this layer's transition conditions.
Priority Evaluation order relative to other layers (base animator is priority 0). Higher values are applied last and win. Must be ≥ 1.
StateMachine The state machine for this layer. Evaluated each frame by AnimationSystem before the animator is advanced.
Weight Blend weight [0, 1]. 1 = full override; 0 = no effect. Clamped on set.
Methods
CaptureSnapshot() Captures a snapshot of this layer's current runtime configuration: Weight, Mask, BlendMode, and IsEnabled. Use RestoreSnapshot(AnimationLayerSnapshot) to restore the captured state atomically.
RestoreSnapshot(AnimationLayerSnapshot) Restores a previously captured snapshot, atomically setting Weight, Mask, BlendMode, and IsEnabled.