@pixerate/flair 0.21.1 → 0.23.0

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.
@@ -1,3 +1,49 @@
1
+ /**
2
+ * Time source for generative animations and playback.
3
+ * By default that is real time (animation frames and timers).
4
+ * A ManualClock instead moves only when told to, enabling frame-exact
5
+ * rendering, video recording, scrubbing, or fast simulation without waiting.
6
+ */
7
+ interface Clock {
8
+ /** Current time in milliseconds. */
9
+ now(): number;
10
+ /** Resolves on the next frame. */
11
+ frame(): Promise<void>;
12
+ /** Resolves after `ms` milliseconds of this clock's time. */
13
+ sleep(ms: number): Promise<void>;
14
+ /**
15
+ * Whether the clock follows wall time. Live clocks stop when the tab is in
16
+ * the background (browsers pause animation frames there).
17
+ */
18
+ readonly live: boolean;
19
+ }
20
+ declare const pageHidden: () => boolean;
21
+ declare const realClock: Clock;
22
+ /**
23
+ * A clock that only moves when {@link advance} or {@link tick} is called.
24
+ * Each call fires the sleeps that fall due, in order, letting awaiting code
25
+ * run before the next sleep fires, then resolves pending frames.
26
+ */
27
+ declare class ManualClock implements Clock {
28
+ readonly live = false;
29
+ private time;
30
+ private frames;
31
+ private sleepers;
32
+ private seq;
33
+ constructor(start?: number);
34
+ now(): number;
35
+ frame(): Promise<void>;
36
+ sleep(ms: number): Promise<void>;
37
+ get pending(): boolean;
38
+ advance(ms: number): Promise<void>;
39
+ tick(fps?: number): Promise<void>;
40
+ }
41
+ /**
42
+ * A repeatable pseudo-random number in [0, 1) for a key and index.
43
+ * Useful for deterministic, reproducible animations.
44
+ */
45
+ declare function jitter(key: string, n: number): number;
46
+
1
47
  /**
2
48
  * Vector motion: animated SVG pictures described as data. A picture changes in
3
49
  * steps (step 0 when it starts, step n at `steps[n - 1]` ms), and everything
@@ -183,52 +229,6 @@ declare function svgOpeningTag(markup: string): string;
183
229
  /** Problems with an {@link SvgMotion}, as sentences; none when it can be drawn. */
184
230
  declare function svgMotionIssues(motion: unknown): string[];
185
231
 
186
- /**
187
- * Time source for generative animations and playback.
188
- * By default that is real time (animation frames and timers).
189
- * A ManualClock instead moves only when told to, enabling frame-exact
190
- * rendering, video recording, scrubbing, or fast simulation without waiting.
191
- */
192
- interface Clock {
193
- /** Current time in milliseconds. */
194
- now(): number;
195
- /** Resolves on the next frame. */
196
- frame(): Promise<void>;
197
- /** Resolves after `ms` milliseconds of this clock's time. */
198
- sleep(ms: number): Promise<void>;
199
- /**
200
- * Whether the clock follows wall time. Live clocks stop when the tab is in
201
- * the background (browsers pause animation frames there).
202
- */
203
- readonly live: boolean;
204
- }
205
- declare const pageHidden: () => boolean;
206
- declare const realClock: Clock;
207
- /**
208
- * A clock that only moves when {@link advance} or {@link tick} is called.
209
- * Each call fires the sleeps that fall due, in order, letting awaiting code
210
- * run before the next sleep fires, then resolves pending frames.
211
- */
212
- declare class ManualClock implements Clock {
213
- readonly live = false;
214
- private time;
215
- private frames;
216
- private sleepers;
217
- private seq;
218
- constructor(start?: number);
219
- now(): number;
220
- frame(): Promise<void>;
221
- sleep(ms: number): Promise<void>;
222
- get pending(): boolean;
223
- advance(ms: number): Promise<void>;
224
- tick(fps?: number): Promise<void>;
225
- }
226
- /**
227
- * A repeatable pseudo-random number in [0, 1) for a key and index.
228
- * Useful for deterministic, reproducible animations.
229
- */
230
- declare function jitter(key: string, n: number): number;
231
-
232
232
  /**
233
233
  * Drawing animated SVG pictures (see `SvgMotion`) in the DOM: a sanitising
234
234
  * parser, a view that applies frames, and a player that runs on a `Clock`.