Skip to content

AnimationClip.AddEventAtFrame(string, int, Action, bool) Method

Definition

Namespace: Brine2D.Animation

Adds a named event marker that fires when playback reaches the given zero-based frame index. Unlike AddEvent(string, float, Action<ClipEventArgs>, bool), the resolved time is automatically kept up-to-date when any frame's Duration changes while it belongs to this clip.

public Brine2D.Animation.AnimationClip AddEventAtFrame(string name, int frameIndex, System.Action<Brine2D.Animation.ClipEventArgs> callback, bool fireBothDirections=false);

Parameters

name System.String

Identifier for this event.

frameIndex System.Int32

Zero-based index of the frame at which the event should fire.

callback System.Action<ClipEventArgs>

The action to invoke when the event fires.

fireBothDirections System.Boolean

When true and the owning clip uses PingPong, the event also fires during the backward sweep.

Returns

AnimationClip

Exceptions

System.ArgumentOutOfRangeException
Thrown if frameIndex is negative or exceeds the current frame count.