Skip to content

AnimatorPlaybackSnapshot(string, int, float, float, bool, bool, bool, bool, bool, int, float, float, float, float, float, string, int) Constructor

Definition

Namespace: Brine2D.Animation

Immutable capture of a SpriteAnimator's runtime playback state. Use CapturePlaybackSnapshot() and RestorePlaybackSnapshot(AnimatorPlaybackSnapshot) to save and restore mid-frame position, speed, direction, ping-pong phase, and cross-fade state atomically.

public AnimatorPlaybackSnapshot(string? ClipName, int FrameIndex, float ClipTime, float FrameTimer, bool IsPlaying, bool IsPaused, bool Reversed, bool PingPongForward, bool PingPongFirstPassDone, int LoopCountRemaining, float Speed, float CrossFadeAlpha, float CrossFadeTimer, float CrossFadeDuration, float CrossFadeBaseAlpha, string? CrossFadeOutgoingClipName, int CrossFadeOutgoingFrameIndex);

Parameters

ClipName System.String

FrameIndex System.Int32

ClipTime System.Single

FrameTimer System.Single

IsPlaying System.Boolean

IsPaused System.Boolean

Reversed System.Boolean

PingPongForward System.Boolean

PingPongFirstPassDone System.Boolean

LoopCountRemaining System.Int32

Speed System.Single

CrossFadeAlpha System.Single

CrossFadeTimer System.Single

CrossFadeDuration System.Single

CrossFadeBaseAlpha System.Single

CrossFadeOutgoingClipName System.String

CrossFadeOutgoingFrameIndex System.Int32

Remarks

The snapshot is a value-level copy: it holds the clip name (not a clip reference) so that it survives clip replacement and serialization round-trips. When RestorePlaybackSnapshot(AnimatorPlaybackSnapshot) is called it re-resolves the clip by name; if the clip is no longer registered the restore is a no-op and returns false.

Primary use cases are save/load (rehydrating exact mid-animation state from a save file), rollback netcode (rewinding all game state to a prior tick for resimulation), and cutscene/ability override systems (temporarily hijacking an animator then restoring the interrupted playback state, including any cross-fade in progress).

Cross-fade state (Brine2D.Animation.AnimatorPlaybackSnapshot.CrossFadeAlpha, Brine2D.Animation.AnimatorPlaybackSnapshot.CrossFadeOutgoingClipName, Brine2D.Animation.AnimatorPlaybackSnapshot.CrossFadeOutgoingFrameIndex) is included so that in-progress fades survive a save/load cycle. If the outgoing clip is no longer registered on restore, the cross-fade is discarded and playback resumes from the incoming clip with full alpha.