@markgrafhq/markgraf-react 0.1.4 → 0.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -34,6 +34,14 @@ export interface MarkgrafApi<E extends Element = HTMLCanvasElement> {
34
34
  seek(seconds: number): void;
35
35
  /** `1.0` is normal playback speed. */
36
36
  setSpeed(speed: number): void;
37
+ /**
38
+ * Register a callback that fires every time the player enters the named
39
+ * keyframe. Fires immediately if already in that frame. Returns an
40
+ * unsubscribe function.
41
+ */
42
+ onFrameEnter(frameName: string, callback: () => void): () => void;
43
+ /** Seek to the start of the named keyframe. No-op if the frame doesn't exist. */
44
+ seekFrame(frameName: string): void;
37
45
  }
38
46
 
39
47
  export interface UseMarkgrafOptions<R extends "canvas" | "svg" = "canvas"> {
@@ -80,6 +88,14 @@ export interface MarkgrafPlayerProps {
80
88
  transparent?: boolean;
81
89
  width?: number;
82
90
  height?: number;
91
+ /**
92
+ * Map of keyframe names to callbacks. Each callback fires once when the
93
+ * player enters that keyframe (not on every animation frame). Callbacks
94
+ * registered when the player is already in the matching frame fire
95
+ * immediately. Use `useMarkgraf` if you need more control (e.g. pausing
96
+ * from the callback).
97
+ */
98
+ onFrameEnter?: Record<string, () => void>;
83
99
  }
84
100
 
85
101
  /**