@weasel-js/animator 0.0.0-stage → 1.9.4

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.
@@ -0,0 +1,1353 @@
1
+ import { EasingSpec, SpringPresetName, EasingName, BezierEasing, GlMat3, Path, PolygonPath } from '@weasel-js/geom';
2
+ export { BezierEasing, EasingFn, EasingSpec, SpringPreset, SpringPresetName } from '@weasel-js/geom';
3
+ import { ColorSpace } from '@weasel-js/paint';
4
+
5
+ /** How a target's value maps to the flat numbers an animation moves, and back. */
6
+ interface TargetAxes<T> {
7
+ count: number;
8
+ to(value: T): number[];
9
+ from(axes: ArrayLike<number>): T;
10
+ /** Indexes of axes that are angles in radians. An animation starting from one takes the short
11
+ * way round to its destination. */
12
+ angles?: readonly number[];
13
+ /** Optional. `value` with `delta` added axis by axis: what `from` answers for `to(value)`
14
+ * plus `delta`, built with no array between. A read of a moving target goes through it. */
15
+ add?(value: T, delta: ArrayLike<number>): T;
16
+ /** Optional. Puts `value`'s axes into `out` from `at`: what `to` answers, with no array
17
+ * built. `readInto` goes through it. */
18
+ write?(value: T, out: AxisBuffer, at: number): void;
19
+ }
20
+ /** Somewhere a target's axes are written as numbers. */
21
+ type AxisBuffer = Float64Array | Float32Array | number[];
22
+ /** What {@link createTarget} takes. */
23
+ interface TargetOptions<T> {
24
+ /** The committed value: what shows when nothing is animating. */
25
+ get(): T;
26
+ /** Commits a value: an animation's destination as it starts, and where a canceled one stopped. */
27
+ set(value: T): void;
28
+ /** How `T` maps to numbers. Default: a number, an array of numbers, or a plain object whose
29
+ * fields are all numbers, read from `get()` when the target is made. */
30
+ axes?: TargetAxes<T>;
31
+ /** Called once a frame, after the frame's animations, with the value to show: on every frame
32
+ * the target is moving, as an animation starts on it or is redirected, and once more as it
33
+ * comes to rest. Omit for a target whose reader
34
+ * calls `read()` itself. */
35
+ show?(value: T): void;
36
+ /** Called once a frame, after every target that was shown that frame: for a table that
37
+ * publishes many targets at once. Targets passing the same function share one call. */
38
+ publish?(): void;
39
+ }
40
+ /**
41
+ * One value an animator can move. Pass it as `target` to `tween`, `spring`, `physics` or `decay`.
42
+ *
43
+ * An animation on a target commits its destination when it starts and contributes only what is
44
+ * left to travel, so several on one target add: a second started mid-flight bends the motion
45
+ * toward its own destination and neither cancels the other.
46
+ */
47
+ interface Target<T> {
48
+ /** The value to show: the committed value plus what every running animation has left to travel. */
49
+ read(): T;
50
+ /**
51
+ * As `read`, as numbers: writes the value's `axisCount` axes into `out` from `at` (default 0),
52
+ * in the order the target's `axes.to` answers them. For a reader of many targets that wants
53
+ * the numbers and no value built for each.
54
+ */
55
+ readInto(out: AxisBuffer, at?: number): void;
56
+ /** How many axes `readInto` writes. */
57
+ readonly axisCount: number;
58
+ /** How its value maps to numbers. */
59
+ readonly axes: TargetAxes<T>;
60
+ /** The committed value: what shows once nothing is moving it. */
61
+ committed(): T;
62
+ /** Writes the committed value. Animations moving the target go on adding to the new one. */
63
+ commit(value: T): void;
64
+ /** Whether any animation is moving it. */
65
+ readonly active: boolean;
66
+ /**
67
+ * Stops every animation moving it. Each commits where it was, so the value on screen stays,
68
+ * unless `commit` is false: then the committed value is left as it stands and the target
69
+ * shows it. Pass false after something else has written the committed value mid-flight.
70
+ */
71
+ stop(opts?: {
72
+ commit?: boolean;
73
+ }): void;
74
+ }
75
+ /** Make a {@link Target} over a value the caller owns. */
76
+ declare function createTarget<T>(opts: TargetOptions<T>): Target<T>;
77
+
78
+ /** Which of a node's two per-anchor color arrays an override applies to. */
79
+ type VertexColorChannel = 'fill' | 'stroke';
80
+ /** Function-form override: receives the consumer-supplied base color
81
+ * array and the current animation timestamp (ms, from the animator's
82
+ * clock). Returns a flat RGBA float array (values in 0..1, matching
83
+ * the renderer's `stroke.vertexColors` / `PathDrawCommand.vertexColors`
84
+ * color space) of the same length as `base`. */
85
+ type ColorOverrideFn = (base: readonly number[], tMs: number) => number[];
86
+ /** Either a static per-anchor RGBA float array (0..1) or a function-form
87
+ * override (see {@link ColorOverrideFn}). */
88
+ type ColorOverride = readonly number[] | ColorOverrideFn;
89
+ /** Per-node, per-channel store of color overrides. Attached to `useAnimator` as
90
+ * `animator.colorOverrides`; painted onto scene nodes by `<SceneCanvas animator>`
91
+ * and onto a `createPathLayer`'s nodes by its `colorOverrides` option. */
92
+ declare class ColorOverrideRegistry {
93
+ private readonly map;
94
+ private readonly slots;
95
+ private readonly tables;
96
+ private _version;
97
+ set(id: string, channel: VertexColorChannel, override: ColorOverride): void;
98
+ /** Drops `id`'s override on `channel`, and the colors a finished or canceled animation on its
99
+ * {@link target} left painted. An animation still running goes on. */
100
+ clear(id: string, channel: VertexColorChannel): void;
101
+ clearAll(): void;
102
+ /** What `set` stored for `id`'s `channel`; failing that, the colors its {@link target} paints. */
103
+ get(id: string, channel: VertexColorChannel): ColorOverride | undefined;
104
+ /** Whether anything overrides `id`, on either channel. */
105
+ has(id: string): boolean;
106
+ /**
107
+ * The {@link Target} for `id`'s colors on `channel`: `length` numbers, flat RGBA per anchor.
108
+ * Every caller for one node and channel gets the same one, so their animations add. The
109
+ * registry holds its committed colors and nothing writes the scene.
110
+ *
111
+ * What it paints: with no override from `set`, its colors in place of the painter's own; over
112
+ * one, only what its animations have left to travel, added on top. Ask again for each
113
+ * animation rather than keeping it: {@link release} and {@link clear} drop a resting one, and
114
+ * the target it had throws from then on.
115
+ */
116
+ target(id: string, channel: VertexColorChannel, length: number): Target<number[]>;
117
+ private tableOf;
118
+ private drop;
119
+ /** Drops the colors `id`'s {@link target} on `channel` left painted, unless an animation is
120
+ * still moving it. An override from `set` stays. */
121
+ release(id: string, channel: VertexColorChannel): void;
122
+ /**
123
+ * The colors to paint on `id`'s `channel`, given the colors the painter would
124
+ * otherwise paint and the frame's timestamp. A function override needs that
125
+ * `base` and must return an array of its length; failing either, `base`
126
+ * stands. A {@link target} in motion then adds what it has left to travel.
127
+ */
128
+ resolve(id: string, channel: VertexColorChannel, base: readonly number[] | undefined, tMs: number): readonly number[] | undefined;
129
+ private apply;
130
+ version(): number;
131
+ }
132
+
133
+ /** One keyframe. `easing` shapes the approach INTO this key from the previous
134
+ * one, so the first key's easing is never consulted. */
135
+ interface Keyframe<T> {
136
+ /** Time within the track's timeline, in ms. */
137
+ t: number;
138
+ value: T;
139
+ /** A function, the name of a built-in, or cubic-bezier control points. */
140
+ easing?: EasingSpec;
141
+ }
142
+ /** A track sampled as a pure function of the playhead. Scrubbing one is free
143
+ * and order-independent. Give it `onTick`, a `target`, or both. */
144
+ interface SampledTrack<T> {
145
+ kind: 'sampled';
146
+ label?: string;
147
+ /** Sorted ascending by `t`. Of keys sharing a time, the last in the array is
148
+ * the value at exactly that time. */
149
+ keys: Keyframe<T>[];
150
+ /** Required unless the track has a `target`, or every key's value is a number, a number
151
+ * array or a plain object of numbers, all of one shape; those are lerped field by field. */
152
+ interpolate?: Interpolate<T>;
153
+ /** Built once per segment and cached. Takes precedence over `interpolate`. */
154
+ interpolator?: InterpolatorFactory<T>;
155
+ /** Told each sampled value, at any playhead. Optional beside a `target`. */
156
+ onTick?: (value: T) => void;
157
+ /**
158
+ * A value for the track to move. While the playhead is within the track's keys, the target
159
+ * shows the sampled value in place of its committed one, as under `animator.hold`, with
160
+ * what an animation on the target shows apart from its destination added on top. Once the playhead is past the last key, or the
161
+ * timeline finishes or is canceled, the target keeps the value it was showing; before the
162
+ * first key the track leaves the target alone.
163
+ *
164
+ * With no `interpolate` or `interpolator`, the track is sampled in the target's axes: each
165
+ * axis lerps on its own, an angle axis the short way round from the key before, and every
166
+ * sample is a value the axes built, a key's own included.
167
+ */
168
+ target?: Target<T>;
169
+ /** What `target` goes by in a clip, for `toClip` to write and a `ClipBinder` to resolve.
170
+ * A target has no name of its own. */
171
+ targetName?: string;
172
+ /** What `interpolate` goes by in a clip, as `targetName` is for `target`. */
173
+ interpolateName?: string;
174
+ /** The track's share among the target's holds, as `HoldOptions.weight`. Default 1. */
175
+ weight?: number | (() => number);
176
+ /** The axes of the target the track holds, as `HoldOptions.axes`. Default: every axis. */
177
+ axes?: readonly number[];
178
+ }
179
+ /** A clock that events are booked against, reading in ms. An `AudioEngine`
180
+ * from `@weasel-js/audio` is one. */
181
+ interface TimelineClock {
182
+ now(): number;
183
+ }
184
+ /** What `book` hands back so the booking can be retracted. A `VoiceHandle` from
185
+ * `@weasel-js/audio` is one. */
186
+ interface EventBookingHandle {
187
+ stop(): void;
188
+ }
189
+ /** One entry on an `EventTrack`. Give it `fire`, `book`, or both. */
190
+ interface TimelineEvent {
191
+ /** Time within the track's timeline, in ms. */
192
+ t: number;
193
+ /** What the event goes by in a clip: a `ClipBinder` turns it and `data` into `fire` and
194
+ * `book`. */
195
+ name?: string;
196
+ /** Carried with `name` into a clip. Anything JSON holds. */
197
+ data?: unknown;
198
+ /** Runs on the frame that crosses the edge, told how far behind the frame it
199
+ * was crossed, in ms — never negative, and measured against `duration` on
200
+ * the loop seam, where the outgoing lap's tail fires after the wrap. */
201
+ fire?: (lateBy: number) => void;
202
+ /** Runs up to `booking.lookahead` before the edge on a timeline with a
203
+ * `booking`, once per crossing, with the `booking.clock` time the edge lands
204
+ * at — never earlier than that clock's `now()`. A returned handle is stopped
205
+ * if a pause, seek, rate change, loop change, edit or cancel invalidates the
206
+ * booking before the clock reaches `when`; the event is then booked again
207
+ * wherever playback next reaches it. A booking with no handle stands. */
208
+ book?: (when: number) => EventBookingHandle | void;
209
+ }
210
+ /** A track of edge crossings, in forward playback only — a `seek` neither
211
+ * fires nor books the span it skips. An event the playhead is sitting on,
212
+ * after a seek or at the start, fires when playback next advances from there
213
+ * and never while paused. */
214
+ interface EventTrack {
215
+ kind: 'event';
216
+ label?: string;
217
+ /** Sorted ascending by `t`. */
218
+ events: TimelineEvent[];
219
+ }
220
+ /** How a timeline books its events against an outside clock. */
221
+ interface EventBooking {
222
+ clock: TimelineClock;
223
+ /** How far ahead of the playhead to book, in clock ms. Default 100. An event
224
+ * first reached later than this — after a frame longer than it — books late. */
225
+ lookahead?: number;
226
+ /** An event first reached more than this many clock ms after its edge is
227
+ * skipped instead of booked late. Default `Infinity`. */
228
+ maxLate?: number;
229
+ }
230
+ /** A nested timeline, evaluated at `playhead - at`. Children are NOT registered
231
+ * with the animator separately; the parent evaluates them. */
232
+ interface TimelineTrack {
233
+ kind: 'timeline';
234
+ label?: string;
235
+ at: number;
236
+ timeline: NestedTimeline;
237
+ }
238
+ /** Any track a timeline can hold. */
239
+ type Track = SampledTrack<any> | EventTrack | TimelineTrack;
240
+ /** What a child timeline may declare. The parent owns playback, so `loop`,
241
+ * `autoplay`, `onDone` and `cancelKey` have no meaning below the root. */
242
+ interface NestedTimeline {
243
+ tracks: Track[];
244
+ /** Defaults to the largest end time across `tracks`. */
245
+ duration?: number;
246
+ }
247
+ /** What `animator.timeline` takes: a root timeline, which owns playback. */
248
+ interface TimelineOptions extends NestedTimeline {
249
+ /** `true` loops forever, `n` loops n additional times. Default false. */
250
+ loop?: boolean | number;
251
+ /** Default true. When false the timeline registers but holds at t=0 until resumed. */
252
+ autoplay?: boolean;
253
+ /** Called when playback reaches the end of its last lap. */
254
+ onDone?: () => void;
255
+ /** Any new animation passed the same `cancelKey` cancels this one. */
256
+ cancelKey?: string;
257
+ /** Names this timeline in `animator.watch` events and `animator.live()`. */
258
+ label?: string;
259
+ /** Books each event's `book` against a clock the timeline does not own, so a
260
+ * consumer on that clock lands it at its true sub-frame time. The frame
261
+ * clock's mapping onto it is smoothed each frame and resynced on a jump. */
262
+ booking?: EventBooking;
263
+ }
264
+ /** What `animator.timeline` returns: playback control plus live editing. */
265
+ interface TimelineHandle extends AnimationHandle {
266
+ /** Move the playhead. Fires no event itself, at any depth; an event exactly
267
+ * at `t` fires when playback next advances. Sampled tracks are sampled at
268
+ * `t` at once, so a target they hold reads the new value before the next frame. */
269
+ seek(t: number): void;
270
+ /** Change the loop policy. `true` loops forever, `n` allows n more laps,
271
+ * `false` stops at `duration`. Sets policy only — a timeline already parked
272
+ * at `duration` does not restart, because `rearm` declines to revive one.
273
+ * Rewind it with `seek(0)` and `resume()` to play it again. */
274
+ setLoop(loop: boolean | number): void;
275
+ /** The loop policy as it now stands: `true` endless, `false` stopping at
276
+ * `duration`, `n` for n laps still allowed. A finite count falls as laps
277
+ * are consumed, matching what `setLoop` takes. */
278
+ loop(): boolean | number;
279
+ /** Current playhead in ms. */
280
+ time(): number;
281
+ duration(): number;
282
+ tracks(): readonly Track[];
283
+ /** Run `fn`, then recompute duration, drop cached interpolators, sample the
284
+ * tracks again where the playhead stands, and notify.
285
+ * Every mutation must go through this — an edited keyframe otherwise keeps
286
+ * interpolating toward its old value with no visible error. */
287
+ edit(fn: () => void): void;
288
+ /** Notified after each `edit`. Returns an unsubscribe. */
289
+ subscribe(cb: () => void): () => void;
290
+ /** Notified when playback changes other than by time passing: `pause`,
291
+ * `resume`, `seek`, `setTimeScale`, `setLoop`, a cancel, and the playhead
292
+ * reaching the end. What a view of the playhead listens to, so a change
293
+ * made elsewhere reaches it. Returns an unsubscribe. */
294
+ subscribePlayback(cb: () => void): () => void;
295
+ }
296
+
297
+ /** What every animation on a {@link Target} takes. */
298
+ interface OnTarget<T> {
299
+ /** The value to move. */
300
+ target: Target<T>;
301
+ /** Told this animation's own value each frame: its destination plus what it has left to travel. */
302
+ onTick?: (value: T) => void;
303
+ onDone?: () => void;
304
+ /** Any new animation passed the same cancelKey cancels the prior one in flight. Leave it off
305
+ * to let animations on one target add. */
306
+ cancelKey?: string;
307
+ /** False to take `cancelKey` without canceling the animations holding it, so it adds to them
308
+ * and `cancelKey`, `pauseKey`, and `isActive` reach them all. Default true. */
309
+ interrupt?: boolean;
310
+ /** Names this animation in {@link AnimatorEvent}s and `animator.live()`. */
311
+ label?: string;
312
+ }
313
+ /** A tween on a {@link Target}. `to` is committed as it starts, and it contributes what is left
314
+ * to travel, so it adds to whatever else is moving the target. */
315
+ interface TargetTweenOptions<T> extends OnTarget<T> {
316
+ to: T;
317
+ /** Where its own travel starts. Default: the target's committed value, so the value on screen
318
+ * does not move as it starts. */
319
+ from?: T;
320
+ ms: number;
321
+ easing?: EasingSpec;
322
+ /** The path from `from` to `to`, where a straight line per axis is not it. */
323
+ interpolate?: Interpolate<T>;
324
+ /** As `interpolate`, built once at the start. Takes precedence. */
325
+ interpolator?: InterpolatorFactory<T>;
326
+ }
327
+ /** A spring on a {@link Target}. Needs positive stiffness, damping and mass. Interrupting an
328
+ * animation on the same target under the same `cancelKey`, it starts at that one's velocity
329
+ * unless given its own. */
330
+ interface TargetSpringOptions<T> extends OnTarget<T> {
331
+ to: T;
332
+ /** As {@link TargetTweenOptions.from}. */
333
+ from?: T;
334
+ /** Initial velocity in T-units per second. */
335
+ velocity?: T;
336
+ preset?: SpringPresetName;
337
+ stiffness?: number;
338
+ damping?: number;
339
+ mass?: number;
340
+ /** Distance from `to` and speed, both in axis units, under which it has come to rest. Default 0.01. */
341
+ restThreshold?: number;
342
+ }
343
+ /** Spring and coast as one animation on a {@link Target}. With `to: null` it coasts on its
344
+ * velocity, committing where it is when it stops. */
345
+ interface TargetPhysicsOptions<T> extends Omit<TargetSpringOptions<T>, 'to'> {
346
+ to?: T | null;
347
+ }
348
+ /** What `animator.hold` takes. */
349
+ interface HoldOptions<T> {
350
+ /** The value to hold. */
351
+ target: Target<T>;
352
+ /** What to show in place of the committed value: a value, or a function read each frame. */
353
+ value: T | (() => T);
354
+ /** Its share among the target's holds, 0 to 1: a number, or a function read each frame.
355
+ * Default 1. Holds on one target show their weighted average, and whatever their weights
356
+ * leave short of 1 is the committed value's. */
357
+ weight?: number | (() => number);
358
+ /**
359
+ * Indexes of the target's axes it holds, in the order the target's `TargetAxes.to` answers
360
+ * them. The rest are left to the target's other holds and its committed value, and a release
361
+ * commits only these. Default: every axis. For a rig's joints, `jointAxes`.
362
+ */
363
+ axes?: readonly number[];
364
+ /** Any new animation passed the same cancelKey cancels this one. */
365
+ cancelKey?: string;
366
+ /** Names this hold in {@link AnimatorEvent}s and `animator.live()`. */
367
+ label?: string;
368
+ /** With `false`, it takes its `cancelKey` without canceling whoever holds it. Default true. */
369
+ interrupt?: boolean;
370
+ }
371
+ /** What `animator.hold` returns. `cancel` commits what the hold was showing, as `release()`
372
+ * does; pausing it or scaling its time changes nothing, since it has no clock. */
373
+ interface HoldHandle extends AnimationHandle {
374
+ /** Says a function-form `value` or `weight` changed outside a frame, so the target shows it
375
+ * now rather than at the next frame the animator happens to run. */
376
+ touch(): void;
377
+ /** Ends the hold. By default it commits the value it was showing, so the target stays where
378
+ * it is; with `commit: false` the committed value is left alone and the target falls back
379
+ * to it. */
380
+ release(opts?: {
381
+ commit?: boolean;
382
+ }): void;
383
+ }
384
+ /** A coast on a {@link Target}: it commits where it stops. */
385
+ interface TargetDecayOptions<T> extends OnTarget<T> {
386
+ /** As {@link TargetTweenOptions.from}. */
387
+ from?: T;
388
+ velocity: T;
389
+ /** Per-second velocity multiplier in (0, 1). Default 0.95. */
390
+ friction?: number;
391
+ /** Speed below which it stops. Default 0.5. */
392
+ threshold?: number;
393
+ }
394
+
395
+ /** Blends two `T` values at eased progress `t`. Called once per frame; see
396
+ * {@link InterpolatorFactory} when the blend has setup worth hoisting. */
397
+ type Interpolate<T> = (from: T, to: T, t: number) => T;
398
+ /** Factory interpolator: built ONCE at tween start with (from, to), the returned
399
+ * function is called with `t ∈ [0, 1]` each frame. Use for interpolators with
400
+ * expensive setup (color-space conversion, path-string parsing) — d3-interpolate's
401
+ * shape exactly. For cheap interpolations the per-tick `Interpolate<T>` form is
402
+ * fine; this is the escape hatch when setup-per-tick is wasteful. */
403
+ type InterpolatorFactory<T> = (from: T, to: T) => (t: number) => T;
404
+ /** A running animation. Cancel it, or bend its time — pausing and time-scaling
405
+ * act on this animation's own virtual clock, independent of the animator's. */
406
+ interface AnimationHandle {
407
+ /** Monotonic id assigned by the animator. */
408
+ id: number;
409
+ /** Cancel this animation. Idempotent — no-op once already finished/canceled. */
410
+ cancel(): void;
411
+ /** Freeze this animation's virtual clock. Idempotent. */
412
+ pause(): void;
413
+ /** Resume this animation's virtual clock. Idempotent. */
414
+ resume(): void;
415
+ /** Multiply this animation's virtual-clock rate by `scale`, 0 or above. 1 = normal. */
416
+ setTimeScale(scale: number): void;
417
+ /** This animation's own time scale. 1 once it has finished, since the
418
+ * animator no longer holds an entry to read. */
419
+ timeScale(): number;
420
+ /** True iff this handle is currently paused. */
421
+ isPaused(): boolean;
422
+ }
423
+ /** A duration-based animation from `from` to `to` over `ms`, shaped by an
424
+ * easing curve. Reach for a spring instead when the motion should respond to
425
+ * where the value already is rather than restart from a fixed duration. */
426
+ interface TweenOptions<T> {
427
+ /** Absent: this form hands values to `onTick`. The `Target` form of these options moves a target. */
428
+ target?: undefined;
429
+ from: T;
430
+ to: T;
431
+ ms: number;
432
+ easing?: EasingSpec;
433
+ /** Required when T is not `number`. For T = number, defaults to linear numeric lerp.
434
+ * Called per-tick with `(from, to, t)`. For interpolators with expensive setup,
435
+ * prefer `interpolator` which is built once at tween start. */
436
+ interpolate?: Interpolate<T>;
437
+ /** Factory interpolator built once at tween start. Takes precedence over
438
+ * `interpolate` when both are provided. Use this for d3-interpolate or any
439
+ * `(from, to) => (t) => v` shape. */
440
+ interpolator?: InterpolatorFactory<T>;
441
+ onTick: (value: T) => void;
442
+ onDone?: () => void;
443
+ /** Any new animation passed the same cancelKey cancels the prior one in flight. */
444
+ cancelKey?: string;
445
+ /** Names this animation in {@link AnimatorEvent}s and `animator.live()`. */
446
+ label?: string;
447
+ }
448
+ /** A spring animation: runs until the value settles on `to` rather than for a
449
+ * set duration, so it absorbs an initial velocity naturally. Non-numeric `T`
450
+ * needs the four vector helpers. */
451
+ interface SpringOptions<T> {
452
+ /** Absent: this form hands values to `onTick`. The `Target` form of these options moves a target. */
453
+ target?: undefined;
454
+ from: T;
455
+ to: T;
456
+ /** Initial velocity in T-units per second. Default: zero (T-shape-aware). */
457
+ velocity?: T;
458
+ preset?: SpringPresetName;
459
+ stiffness?: number;
460
+ damping?: number;
461
+ mass?: number;
462
+ interpolate?: Interpolate<T>;
463
+ /** Vector helpers — required for non-numeric T. When `from`, `to` and `velocity` are numbers, number
464
+ * arrays or plain objects of numeric fields of one shape, and stiffness, damping and mass are
465
+ * positive, the motion is solved in closed form and these only decide when it has come to rest —
466
+ * a `subtract` that wraps an angle won't change the path. */
467
+ add?: (a: T, b: T) => T;
468
+ subtract?: (a: T, b: T) => T;
469
+ scale?: (v: T, k: number) => T;
470
+ magnitude?: (v: T) => number;
471
+ /** Velocity magnitude below which the spring is considered settled. Default 0.01. */
472
+ restThreshold?: number;
473
+ onTick: (value: T) => void;
474
+ onDone?: () => void;
475
+ cancelKey?: string;
476
+ /** Names this animation in {@link AnimatorEvent}s and `animator.live()`. */
477
+ label?: string;
478
+ }
479
+ /** Spring and decay as one animation. With a `to`, a spring pulls toward it;
480
+ * with `to: null`, the value coasts on its velocity. Either can become the
481
+ * other mid-flight through the handle. */
482
+ interface PhysicsOptions<T> {
483
+ /** Absent: this form hands values to `onTick`. The `Target` form of these options moves a target. */
484
+ target?: undefined;
485
+ from: T;
486
+ /** Target. `null` ⇒ no spring force (decay-mode). */
487
+ to?: T | null;
488
+ /** Initial velocity in T-units per second. */
489
+ velocity?: T;
490
+ preset?: SpringPresetName;
491
+ stiffness?: number;
492
+ damping?: number;
493
+ mass?: number;
494
+ restThreshold?: number;
495
+ /** Vector helpers — required for non-numeric T. When `from`, `to` and `velocity` are numbers, number
496
+ * arrays or plain objects of numeric fields of one shape, and stiffness, damping and mass are
497
+ * positive, the motion is solved in closed form and these only decide when it has come to rest —
498
+ * a `subtract` that wraps an angle won't change the path. */
499
+ add?: (a: T, b: T) => T;
500
+ subtract?: (a: T, b: T) => T;
501
+ scale?: (v: T, k: number) => T;
502
+ magnitude?: (v: T) => number;
503
+ onTick: (value: T) => void;
504
+ onDone?: () => void;
505
+ cancelKey?: string;
506
+ /** Names this animation in {@link AnimatorEvent}s and `animator.live()`. */
507
+ label?: string;
508
+ }
509
+ /** An `AnimationHandle` that can also be steered while it runs — the point of
510
+ * the physics primitive. */
511
+ interface PhysicsHandle<T = unknown> extends AnimationHandle {
512
+ /** Retarget mid-flight. `null` ⇒ switch to decay-mode (no spring force). */
513
+ setTarget(to: T | null): void;
514
+ /** Replace the current velocity in T-units per second. */
515
+ setVelocity(v: T): void;
516
+ }
517
+ /** Momentum: coast from `from` at `velocity`, slowing by `friction` each
518
+ * second until below `threshold`. What a flick-to-pan leaves behind. */
519
+ interface DecayOptions<T> {
520
+ /** Absent: this form hands values to `onTick`. The `Target` form of these options moves a target. */
521
+ target?: undefined;
522
+ from: T;
523
+ velocity: T;
524
+ /** Per-second velocity multiplier in (0, 1). Default 0.95. */
525
+ friction?: number;
526
+ /** Velocity magnitude below which decay stops. Default 0.5. */
527
+ threshold?: number;
528
+ /** When `from` and `velocity` are numbers, number arrays or plain objects of numeric fields of one
529
+ * shape and `friction` is below 1, the motion is solved in closed form: `add` and `scale` go
530
+ * unused and `magnitude` only decides when it has come to rest. */
531
+ add: (a: T, b: T) => T;
532
+ scale: (v: T, k: number) => T;
533
+ magnitude: (v: T) => number;
534
+ onTick: (value: T) => void;
535
+ onDone?: () => void;
536
+ cancelKey?: string;
537
+ /** Names this animation in {@link AnimatorEvent}s and `animator.live()`. */
538
+ label?: string;
539
+ }
540
+ /** Options for `useAnimator`. Everything here is an injection seam for tests;
541
+ * the defaults are the real clock and rAF. */
542
+ interface UseAnimatorOptions {
543
+ /** Optional clock injection for tests. Returns ms since some epoch. */
544
+ now?: () => number;
545
+ /** Optional rAF / cAF injection for tests. Defaults to window.requestAnimationFrame. */
546
+ requestFrame?: (cb: (t: number) => void) => number;
547
+ cancelFrame?: (handle: number) => void;
548
+ }
549
+ /**
550
+ * Owns every running animation on a canvas and drives them from one rAF loop.
551
+ * Beyond the primitives (`tween`, `spring`, `decay`, `physics`) it offers
552
+ * composition — `loop`, `stagger` — and bulk control by handle, by cancel-key,
553
+ * or over everything at once.
554
+ *
555
+ * An animator does not know about the scene. An animation either reports values
556
+ * through `onTick` and the caller decides what to do with them, or moves a
557
+ * {@link Target}, where several on one target add.
558
+ */
559
+ interface Animator {
560
+ tween<T>(opts: TweenOptions<T> | TargetTweenOptions<T>): AnimationHandle;
561
+ spring<T>(opts: SpringOptions<T> | TargetSpringOptions<T>): AnimationHandle;
562
+ decay<T>(opts: DecayOptions<T> | TargetDecayOptions<T>): AnimationHandle;
563
+ /** Unified spring/decay primitive. With `to` set, behaves as a spring;
564
+ * with `to: null`, behaves as a velocity-driven decay. Supports
565
+ * mid-flight retargeting via the returned handle's `setTarget`. */
566
+ physics<T>(opts: PhysicsOptions<T> | TargetPhysicsOptions<T>): PhysicsHandle<T>;
567
+ /** Shows a value on a {@link Target} in place of its committed one until canceled or released.
568
+ * It covers an animation's move to a destination; a coast, push, or `from` offset adds on top. */
569
+ hold<T>(opts: HoldOptions<T>): HoldHandle;
570
+ /** Cancel a specific animation by handle. Pose stays at current value (no jump). */
571
+ cancel(handle: AnimationHandle): void;
572
+ /** Cancel every animation currently active under `key`. */
573
+ cancelKey(key: string): void;
574
+ /** Cancel everything. Useful from a destructor or "reset scene" path. */
575
+ cancelAll(): void;
576
+ /** True iff at least one animation is active. With `key`, scoped to that cancelKey. */
577
+ isActive(key?: string): boolean;
578
+ /**
579
+ * True while the animator is currently executing an animation tick. Useful
580
+ * for adapter wrappers (e.g. `animateOnSetPose`) that need to detect
581
+ * "this `setPose` was called from inside another animation's onTick"
582
+ * (momentum decay, in-flight tween, spring) and avoid recursively
583
+ * scheduling a new wrap-animation that would fight the caller.
584
+ */
585
+ isTicking(): boolean;
586
+ /** Freeze every animation managed by this animator. */
587
+ pause(): void;
588
+ /** Resume every animation managed by this animator. */
589
+ resume(): void;
590
+ /** True iff the animator is currently globally paused. */
591
+ isPaused(): boolean;
592
+ /** Multiply every animation's virtual-clock rate by `scale`, 0 or above. 1 = normal. */
593
+ setTimeScale(scale: number): void;
594
+ /** The global time scale. Per-animation scales multiply on top of it. */
595
+ timeScale(): number;
596
+ /** Freeze every animation whose `cancelKey` matches. */
597
+ pauseKey(key: string): void;
598
+ /** Resume every animation whose `cancelKey` matches. */
599
+ resumeKey(key: string): void;
600
+ /** Set per-animation timeScale for every animation whose `cancelKey` matches. */
601
+ setTimeScaleByKey(key: string, scale: number): void;
602
+ /**
603
+ * Loop primitive: repeatedly invoke `factory` to produce a child animation.
604
+ * The factory must wire its returned handle's `onDone` to call `next` so
605
+ * the loop advances. Returns a handle whose pause/resume/setTimeScale/cancel
606
+ * delegate to the current in-flight child (and prevent future iterations
607
+ * on cancel).
608
+ *
609
+ * The loop is registered with the animator under a supervisor entry so
610
+ * `animator.cancel(handle)`, `animator.cancelKey(opts.cancelKey)`, and
611
+ * `animator.isActive(opts.cancelKey)` all work for it.
612
+ */
613
+ loop(factory: LoopFactory, opts?: LoopOptions): AnimationHandle;
614
+ /** Sugar over `loop` for the common case of looping a tween between two
615
+ * values with optional direction handling (`restart` | `reverse` |
616
+ * `alternate`). Registered with the animator like `loop`. */
617
+ tweenLoop<T>(opts: TweenLoopOptions<T>): AnimationHandle;
618
+ /**
619
+ * Stagger primitive: schedule a per-item animation, offset by `delay` ms
620
+ * per index (or a custom function of the index). Two forms:
621
+ * - Factory form: pass `factory` directly, returns a composite
622
+ * `AnimationHandle`.
623
+ * - Builder form: omit `factory`, get a `StaggerBuilder` for fluent
624
+ * `.each` / `.tween` / `.springPose` calls.
625
+ *
626
+ * The composite handle's `cancel` cancels the items still waiting AND the
627
+ * in-flight children. The delays run on the animator's clock, not the
628
+ * wall's: a pause or a time scale, on the handle, by `cancelKey` or on the
629
+ * whole animator, holds or stretches the waiting items along with the
630
+ * children, and a hidden tab holds both.
631
+ *
632
+ * The stagger is registered with the animator under a supervisor entry so
633
+ * `animator.cancel(handle)`, `animator.cancelKey(opts.cancelKey)`, and
634
+ * `animator.isActive(opts.cancelKey)` all work for it.
635
+ */
636
+ stagger<TItem>(items: readonly TItem[], delay: StaggerDelay): StaggerBuilder<TItem>;
637
+ stagger<TItem>(items: readonly TItem[], delay: StaggerDelay, factory: StaggerFactory<TItem>, opts?: StaggerOptions): AnimationHandle;
638
+ /**
639
+ * Keyframe timeline. Registered like any other animation, so its playhead
640
+ * responds to `pause`, `setTimeScale` and `cancelKey`. Sampled tracks are a
641
+ * pure function of the playhead; event tracks fire only on forward playback.
642
+ */
643
+ timeline(opts: TimelineOptions): TimelineHandle;
644
+ /** Per-node, per-channel color override registry, painted onto scene nodes
645
+ * by `<SceneCanvas animator>` and read by `createPathLayer`. `cycleVertexColors`
646
+ * stores an override in it; `tweenVertexColors`, `springVertexColors`, and
647
+ * `staggerVertexColors` move its per-node targets, which only this animator
648
+ * can move. Cleared automatically on animator unmount. */
649
+ colorOverrides: ColorOverrideRegistry;
650
+ /**
651
+ * Subscribe to a callback fired once per RAF frame while any animation is
652
+ * active. Returns an unsubscribe function. Used by consumers (typically
653
+ * `<SceneCanvas>`) that need to repaint when an animation's side-effect
654
+ * is read from a non-scene channel (e.g. `colorOverrides` consulted from
655
+ * a custom `drawOne`) — scene mutations naturally trigger a repaint, but
656
+ * `colorOverrides` writes do not.
657
+ *
658
+ * The callback fires AFTER the per-frame tick of each registered
659
+ * animation, so by the time it runs `colorOverrides.get(...)` returns
660
+ * the latest values. If no animations are active, no tick fires.
661
+ */
662
+ onTick(cb: () => void): () => void;
663
+ /**
664
+ * Keep the animator's RAF loop running until the returned cancel
665
+ * function is called. Use for animations whose effect is read on every
666
+ * frame but which don't have a natural progress state (e.g.
667
+ * `cycleVertexColors`, which expresses its current value as a function
668
+ * of `performance.now()` rather than as a tween from `from` to `to`).
669
+ * Without a keep-alive entry the loop would idle and `onTick` would
670
+ * stop firing even though the override is still installed.
671
+ */
672
+ keepAlive(): () => void;
673
+ /**
674
+ * Subscribe to the lifecycle of every animation this animator runs, the
675
+ * composites and timelines included. Returns an unsubscribe. Events arrive
676
+ * synchronously, as each thing happens — see {@link AnimatorEvent} for the
677
+ * order. With no listener attached nothing is built or delivered, so an
678
+ * unwatched animator pays nothing for this.
679
+ */
680
+ watch(listener: AnimatorListener): () => void;
681
+ /** What is running right now, in registration order: a fresh snapshot per
682
+ * call, for a debug overlay to draw. */
683
+ live(): LiveAnimation[];
684
+ }
685
+ /** Which animator call started an animation. A loop, tween loop or stagger is
686
+ * an entry of its own beside the children it runs; `keepAlive` holds the
687
+ * frame loop open and animates nothing. */
688
+ type AnimationKind = 'tween' | 'spring' | 'decay' | 'physics' | 'timeline' | 'loop' | 'tweenLoop' | 'stagger' | 'keepAlive' | 'hold';
689
+ /** Who an {@link AnimatorEvent} is about. One object per registration, so the
690
+ * same animation's events share it by identity. */
691
+ interface AnimationInfo {
692
+ /** The id on the animation's handle. */
693
+ readonly id: number;
694
+ readonly kind: AnimationKind;
695
+ /** The animation's `cancelKey`. Pose helpers key by node, as `pose:<id>`. */
696
+ readonly key?: string;
697
+ /** The animation's `label` option. */
698
+ readonly label?: string;
699
+ }
700
+ /** One row of `animator.live()`. */
701
+ interface LiveAnimation extends AnimationInfo {
702
+ /** Paused on its own handle. The animator-wide pause is `animator.isPaused()`. */
703
+ readonly paused: boolean;
704
+ /** Its own time scale; the animator's multiplies on top. */
705
+ readonly timeScale: number;
706
+ /** Virtual ms its clock has advanced since it started. */
707
+ readonly elapsed: number;
708
+ /** 0 to 1, for a tween or a timeline (the playhead over its duration).
709
+ * Absent where there is no end to measure against: physics, composites. */
710
+ readonly progress?: number;
711
+ }
712
+ /**
713
+ * One thing happening to an animation, as `animator.watch` delivers it.
714
+ *
715
+ * - `start` — registered. A finished timeline that `seek` or `edit` revives
716
+ * starts again, under the same id.
717
+ * - `end` — finished on its own. Delivered once every animation has ticked
718
+ * that frame, in registration order.
719
+ * - `cancel` — stopped by its handle, `cancel`, `cancelKey` or `cancelAll`.
720
+ * - `interrupt` — stopped because `by` claimed its `cancelKey`. Delivered
721
+ * before `by`'s `start`.
722
+ * - `error` — its tick threw (an `onTick`, `onDone` or interpolator), so it was
723
+ * taken off the table, after the frame's other animations ticked. In place of
724
+ * `cancel`, or after `end` when `onDone` threw. The error is also logged.
725
+ * - `lap` — a looping timeline wrapped; `lap` counts wraps since it started.
726
+ * - `fire` — an event on a timeline's event track was crossed, at any depth.
727
+ * `path` indexes from the root timeline's `tracks()` down through each
728
+ * nested timeline to the event track. Delivered after the event's own `fire`.
729
+ */
730
+ type AnimatorEvent = {
731
+ readonly type: 'start' | 'end' | 'cancel';
732
+ readonly animation: AnimationInfo;
733
+ } | {
734
+ readonly type: 'interrupt';
735
+ readonly animation: AnimationInfo;
736
+ readonly by: AnimationInfo;
737
+ } | {
738
+ readonly type: 'error';
739
+ readonly animation: AnimationInfo;
740
+ readonly error: unknown;
741
+ } | {
742
+ readonly type: 'lap';
743
+ readonly animation: AnimationInfo;
744
+ readonly lap: number;
745
+ } | {
746
+ readonly type: 'fire';
747
+ readonly animation: AnimationInfo;
748
+ readonly track: EventTrack;
749
+ readonly path: readonly number[];
750
+ readonly event: TimelineEvent;
751
+ /** As the event's own `fire` is told: ms behind the frame it was crossed. */
752
+ readonly lateBy: number;
753
+ };
754
+ /** Receives what `animator.watch` delivers. */
755
+ type AnimatorListener = (event: AnimatorEvent) => void;
756
+ /** Options for `Animator.loop`. */
757
+ interface LoopOptions {
758
+ /** Maximum number of iterations. Default Infinity. */
759
+ count?: number;
760
+ /** Invoked when the loop reaches `count` iterations naturally (not on cancel). */
761
+ onDone?: () => void;
762
+ /** Any new animation passed the same cancelKey cancels the prior one in flight.
763
+ * Also enables `animator.cancelKey` / `animator.isActive(key)` for this loop. */
764
+ cancelKey?: string;
765
+ /** Names this loop in {@link AnimatorEvent}s and `animator.live()`. */
766
+ label?: string;
767
+ }
768
+ /** A stagger run's own options: the factory form's fourth argument, and part
769
+ * of every fluent builder method's options. */
770
+ interface StaggerOptions {
771
+ /** Cancel-key for the supervising registration. `animator.cancelKey(key)`
772
+ * cancels the whole stagger; `animator.isActive(key)` returns true while
773
+ * any timer or child is alive. */
774
+ cancelKey?: string;
775
+ /** Names this stagger in {@link AnimatorEvent}s and `animator.live()`. */
776
+ label?: string;
777
+ }
778
+ /** Produces one iteration of a loop. Must arrange for `next` to be called when
779
+ * the animation it returns finishes, or the loop stalls after one pass. */
780
+ type LoopFactory = (iteration: number, next: () => void) => AnimationHandle;
781
+ /** Per-index delay schedule. Number ⇒ `index * delay` ms. Function ⇒ caller
782
+ * decides the absolute delay for each index (e.g. `i => i * i * 30`). */
783
+ type StaggerDelay = number | ((index: number) => number);
784
+ /** Produces the animation for one staggered item. */
785
+ type StaggerFactory<TItem> = (item: TItem, index: number) => AnimationHandle;
786
+ /** A `T` value or a function that derives one from the per-item context. Used
787
+ * by the fluent builder methods (`.tween`, `.springPose`) so each item can
788
+ * vary an option (e.g. `to: (_item, i) => (i + 1) * 10`). */
789
+ type StaggerPerItem<T, TItem> = T | ((item: TItem, index: number) => T);
790
+ /** Options for the stagger builder's `.tween`: a tween per item, where
791
+ * `from`, `to` and `ms` may each vary by item. `cancelKey` and `label` belong
792
+ * to the stagger as a whole, as in {@link StaggerOptions}. */
793
+ interface StaggerTweenOptions<T, TItem> extends StaggerOptions {
794
+ from: StaggerPerItem<T, TItem>;
795
+ to: StaggerPerItem<T, TItem>;
796
+ ms: StaggerPerItem<number, TItem>;
797
+ easing?: EasingSpec;
798
+ interpolate?: Interpolate<T>;
799
+ onTick: (value: T, item: TItem, index: number) => void;
800
+ onDone?: (item: TItem, index: number) => void;
801
+ }
802
+ /** Fluent form of `Animator.stagger`: pick what to run per item after the
803
+ * items and the delay schedule are already fixed. */
804
+ interface StaggerBuilder<TItem> {
805
+ /** Run an arbitrary per-item factory. */
806
+ each(factory: StaggerFactory<TItem>, opts?: StaggerOptions): AnimationHandle;
807
+ /** Sugar: per-item `animator.tween` with per-item-varying options. */
808
+ tween<T>(opts: StaggerTweenOptions<T, TItem>): AnimationHandle;
809
+ }
810
+ /** Options for `Animator.tweenLoop` — a tween's options plus how each
811
+ * iteration relates to the last. */
812
+ interface TweenLoopOptions<T> {
813
+ from: T;
814
+ to: T;
815
+ ms: number;
816
+ easing?: EasingSpec;
817
+ /** `restart` (default): from→to every iteration.
818
+ * `reverse`: to→from every iteration.
819
+ * `alternate`: even iterations from→to, odd iterations to→from. */
820
+ direction?: 'restart' | 'reverse' | 'alternate';
821
+ count?: number;
822
+ interpolate?: Interpolate<T>;
823
+ onTick: (value: T) => void;
824
+ onDone?: () => void;
825
+ cancelKey?: string;
826
+ /** Names this animation in {@link AnimatorEvent}s and `animator.live()`. */
827
+ label?: string;
828
+ }
829
+
830
+ /** Create the animator for a canvas. One rAF loop drives every animation it
831
+ * owns, and everything still running is canceled on unmount. */
832
+ declare function useAnimator(opts?: UseAnimatorOptions): Animator;
833
+
834
+ /** What {@link createTargetTable} takes. */
835
+ interface TargetTableOptions {
836
+ /** How many numbers a row holds. */
837
+ axes: number;
838
+ /** Rows to make room for at first. The table grows past it. Default 64. */
839
+ capacity?: number;
840
+ /** Called after `row` is committed: by `set`, by an animation starting on it, and by one
841
+ * canceled on it. */
842
+ set?(row: number): void;
843
+ /** Called once a frame, after the animator has filled `shown` for the rows it is moving. */
844
+ show?(): void;
845
+ }
846
+ /**
847
+ * Many like values an animator can move, kept as rows of numbers in flat arrays: for thousands
848
+ * of particles, dots, or vertex colors, where a `Target` apiece costs a read apiece. Each row
849
+ * is a target (`target(row)`), so it tweens, springs, coasts, and holds like any other, and
850
+ * every row's value on screen is in `shown` after each frame, with no call per row.
851
+ */
852
+ interface TargetTable {
853
+ readonly axes: number;
854
+ /** How many rows are in use. */
855
+ readonly size: number;
856
+ /** Every row's committed value, row `r` at `r * axes`. A new array once the table grows, so
857
+ * read it from the table each time. Write a row through `set`. */
858
+ readonly committed: Float64Array;
859
+ /** Every row's value on screen, laid out as `committed`: current after each frame of the
860
+ * animator moving the rows, and whenever it is read between frames. A new array once the
861
+ * table grows. */
862
+ readonly shown: Float64Array;
863
+ /** Adds a row at `value` and answers its index, which a removed row's index is reused for. */
864
+ add(value: ArrayLike<number>): number;
865
+ /** Stops whatever is moving `row` and frees it. Its target is dead from here: a row added
866
+ * later may take the index, and gets a target of its own. */
867
+ remove(row: number): void;
868
+ /** Commits `value` to `row`. A row that is moving keeps what its animations have left on top. */
869
+ set(row: number, value: ArrayLike<number>): void;
870
+ /** Row `row` as a target, the same one on every call. */
871
+ target(row: number): Target<number[]>;
872
+ }
873
+ /** Make a {@link TargetTable} whose rows each hold `axes` numbers. */
874
+ declare function createTargetTable(opts: TargetTableOptions): TargetTable;
875
+
876
+ /** How a value maps to the flat numbers blits moves, and back. */
877
+ interface Axes<T> {
878
+ count: number;
879
+ /** Equal for two values exactly when their axes line up one for one. */
880
+ shape: string;
881
+ to(v: T): number[];
882
+ /** The value whose `count` axes start at `at` in `a`. */
883
+ from(a: ArrayLike<number>, at?: number): T;
884
+ /** `v` with `delta` added axis by axis. */
885
+ add(v: T, delta: ArrayLike<number>): T;
886
+ /** Puts `v`'s axes into `out` from `at`. */
887
+ write(v: T, out: Float64Array | Float32Array | number[], at: number): void;
888
+ }
889
+ /** The axes of `sample`'s shape: a number, a plain array of numbers, or a plain object whose
890
+ * fields are all numbers. Null for any other shape, which blits cannot move. */
891
+ declare function axesOf<T>(sample: T): Axes<T> | null;
892
+
893
+ /** Most a slewed value may change per second, in its own units, in each
894
+ * direction. A direction left out is unlimited: the value jumps to a target
895
+ * on that side. `0` holds the value where it is. */
896
+ interface SlewRates {
897
+ rise?: number;
898
+ fall?: number;
899
+ }
900
+ /**
901
+ * One step of a slew limiter: `value` moved toward `target` by at most the
902
+ * rate for that direction times `dt` seconds, landing on `target` rather than
903
+ * passing it. A fast `rise` with a slow `fall` is an attack/release envelope.
904
+ */
905
+ declare function slewToward(value: number, target: number, dt: number, rates: SlewRates): number;
906
+ /** A value that follows `target` at limited rates. Both fields are writable:
907
+ * set `target` to steer it, or write `value` to jump it and let it slew on
908
+ * from there. Nothing moves until `step` is called. */
909
+ interface Slew {
910
+ value: number;
911
+ target: number;
912
+ /** Advance `dt` seconds and return the new value. */
913
+ step(dt: number): number;
914
+ }
915
+ /** A stateful {@link slewToward}. `target` defaults to `value`, so a new slew
916
+ * is at rest. */
917
+ declare function createSlew(options?: SlewRates & {
918
+ value?: number;
919
+ target?: number;
920
+ }): Slew;
921
+
922
+ /**
923
+ * Color interpolator: receives two flat RGBA float arrays (values in
924
+ * 0..1, the renderer's color space — same shape as
925
+ * `stroke.vertexColors`) and a normalized progress `t` in 0..1.
926
+ * Returns the same-length blended array, also in 0..1 floats. Override
927
+ * the default per-channel lerp via `TweenVertexColorsOptions.interpolate`
928
+ * when a custom color-space or shaping is needed.
929
+ */
930
+ type ColorInterpolate = (from: readonly number[], to: readonly number[], t: number) => number[];
931
+
932
+ /** Options for `tweenVertexColors`. */
933
+ interface TweenVertexColorsOptions {
934
+ id: string;
935
+ channel: VertexColorChannel;
936
+ /** Per-anchor RGBA, flat, in 0..1 floats (matches the renderer's
937
+ * `stroke.vertexColors` / `PathDrawCommand.vertexColors` color space).
938
+ * Length must equal `from.length`. */
939
+ to: readonly number[];
940
+ /** Per-anchor RGBA, flat, in 0..1 floats. Length must equal `to.length`
941
+ * and be a positive multiple of 4. */
942
+ from: readonly number[];
943
+ ms: number;
944
+ easing?: EasingSpec;
945
+ interpolation?: ColorSpace;
946
+ interpolate?: ColorInterpolate;
947
+ onDone?: () => void;
948
+ }
949
+ /**
950
+ * Animate one node's per-anchor colors from `from` to `to` over `ms`.
951
+ *
952
+ * It moves the node's color target (`animator.colorOverrides.target`) rather
953
+ * than writing the scene, so nothing is recorded in history and the node's own
954
+ * data is untouched. Another tween or stagger on the same node and channel adds
955
+ * to this one; a spring interrupts it. What it painted is dropped when the last
956
+ * animation on the node and channel finishes, and held where it was if canceled
957
+ * until `animator.colorOverrides.clear`.
958
+ */
959
+ declare function tweenVertexColors(animator: Animator, opts: TweenVertexColorsOptions): AnimationHandle;
960
+ /** Options for `springVertexColors`. */
961
+ interface SpringVertexColorsOptions {
962
+ id: string;
963
+ channel: VertexColorChannel;
964
+ /** Per-anchor RGBA in 0..1 floats. See `TweenVertexColorsOptions.to`. */
965
+ to: readonly number[];
966
+ /** Per-anchor RGBA in 0..1 floats. See `TweenVertexColorsOptions.from`. */
967
+ from: readonly number[];
968
+ preset?: SpringPresetName;
969
+ stiffness?: number;
970
+ damping?: number;
971
+ mass?: number;
972
+ onDone?: () => void;
973
+ }
974
+ /**
975
+ * `tweenVertexColors` driven by a spring instead of a duration. Each number
976
+ * springs on its own, so an underdamped spring overshoots `to` and the path is
977
+ * a straight line in RGB.
978
+ *
979
+ * It interrupts whatever is animating the node and channel, and starts at the
980
+ * velocity of the one it interrupts, so retargeting mid-flight does not stall.
981
+ */
982
+ declare function springVertexColors(animator: Animator, opts: SpringVertexColorsOptions): AnimationHandle;
983
+ /** Options for `staggerVertexColors`. `origin` picks which anchor the wave
984
+ * starts from and `perAnchorDelay` how far behind each successive anchor
985
+ * runs. */
986
+ interface StaggerVertexColorsOptions {
987
+ id: string;
988
+ channel: VertexColorChannel;
989
+ /** Per-anchor RGBA in 0..1 floats. See `TweenVertexColorsOptions.to`. */
990
+ to: readonly number[];
991
+ /** Per-anchor RGBA in 0..1 floats. See `TweenVertexColorsOptions.from`. */
992
+ from: readonly number[];
993
+ anchorMs: number;
994
+ perAnchorDelay: number;
995
+ origin?: 'first' | 'last' | number;
996
+ easing?: EasingSpec;
997
+ interpolation?: ColorSpace;
998
+ interpolate?: ColorInterpolate;
999
+ onDone?: () => void;
1000
+ }
1001
+ /** Run the same color change across a node's anchors as a wave, each anchor
1002
+ * starting later than the one before it. It moves the same target as
1003
+ * `tweenVertexColors`, and adds to other animations the same way. */
1004
+ declare function staggerVertexColors(animator: Animator, opts: StaggerVertexColorsOptions): AnimationHandle;
1005
+
1006
+ /** Options for `cycleVertexColors`. */
1007
+ interface CycleVertexColorsOptions {
1008
+ id: string;
1009
+ channel: VertexColorChannel;
1010
+ msPerCycle: number;
1011
+ direction?: 1 | -1;
1012
+ easing?: EasingSpec;
1013
+ interpolation?: ColorSpace;
1014
+ /** Custom interpolator. Receives two RGBA arrays in 0..1 floats and a
1015
+ * progress `t` in 0..1; returns the blended array in 0..1 floats. */
1016
+ interpolate?: ColorInterpolate;
1017
+ }
1018
+ /** Removes an installed color cycle. Unlike the other color helpers this is
1019
+ * not an `AnimationHandle`, because a cycle has no progress to pause or
1020
+ * scale — it only ends. */
1021
+ interface CycleHandle {
1022
+ cancel(): void;
1023
+ }
1024
+ /** Register a function override that phase-rotates the base color array
1025
+ * along the path index. Returns a handle whose `cancel()` removes the
1026
+ * override.
1027
+ *
1028
+ * The override computes its value purely from `performance.now()`, so
1029
+ * there's no per-frame progress to register with the animator's tick
1030
+ * loop. To keep the loop alive (so `<SceneCanvas animator>`'s onTick
1031
+ * subscription continues firing redraws while the cycle is installed),
1032
+ * cycleVertexColors holds an `animator.keepAlive()` entry for the
1033
+ * lifetime of the cycle; `cancel()` releases it. */
1034
+ declare function cycleVertexColors(animator: Animator, opts: CycleVertexColorsOptions): CycleHandle;
1035
+
1036
+ /** Build an n-anchor rainbow RGBA array sweeping the hue wheel. The
1037
+ * output is suitable to pass directly into `stroke.vertexColors`,
1038
+ * `tweenVertexColors({ from: rainbowVertexColors(n) })`, or any
1039
+ * other API that wants per-anchor color floats. */
1040
+ declare function rainbowVertexColors(n: number, opts?: {
1041
+ saturation?: number;
1042
+ lightness?: number;
1043
+ alpha?: number;
1044
+ }): number[];
1045
+ /** Build an n-anchor solid RGBA array. Shorthand for
1046
+ * `[r, g, b, a, r, g, b, a, …]` — the array a `tweenVertexColors`
1047
+ * `to`-target typically needs. */
1048
+ declare function solidVertexColors(n: number, r: number, g: number, b: number, a?: number): number[];
1049
+
1050
+ /**
1051
+ * Sample a track at `t`. Pure: no state, no side effects, safe to call for any
1052
+ * `t` in any order — which is what makes scrubbing free.
1053
+ *
1054
+ * `segmentCache` holds what sampling builds from the keys: the track's blits
1055
+ * patch and its `interpolator` factories. Handed another track or a replaced
1056
+ * `keys` array, it rebuilds; a key edited in place needs the cache dropped,
1057
+ * which `createTimeline` does on `edit`. With no cache, every call builds afresh.
1058
+ */
1059
+ declare function sampleTrack<T>(track: SampledTrack<T>, t: number, segmentCache?: Map<number, (u: number) => T>): T | undefined;
1060
+
1061
+ /** A value a clip can hold: what `JSON.stringify` writes and `JSON.parse` reads back. An
1062
+ * object's `undefined` members are left out, as JSON leaves them. */
1063
+ type ClipValue = number | string | boolean | null | ClipValue[] | {
1064
+ [key: string]: ClipValue | undefined;
1065
+ };
1066
+ /** A keyframe as data. Its easing is a built-in's name or bezier control points. */
1067
+ interface ClipKey {
1068
+ t: number;
1069
+ value: ClipValue;
1070
+ easing?: EasingName | BezierEasing;
1071
+ }
1072
+ /** A `SampledTrack` as data: what it moves and how it interpolates are names. */
1073
+ interface ClipSampledTrack {
1074
+ kind: 'sampled';
1075
+ label?: string;
1076
+ /** Resolved by `ClipBinder.target`. A track with none is sampled and moves nothing. */
1077
+ target?: string;
1078
+ keys: ClipKey[];
1079
+ /** Resolved from `ClipBinder.interpolate`. Without one the track is sampled in its
1080
+ * target's axes, or field by field. */
1081
+ interpolate?: string;
1082
+ weight?: number;
1083
+ axes?: number[];
1084
+ }
1085
+ /** An `EventTrack` as data: each event is a name and what to carry with it. */
1086
+ interface ClipEventTrack {
1087
+ kind: 'event';
1088
+ label?: string;
1089
+ events: {
1090
+ t: number;
1091
+ name: string;
1092
+ data?: ClipValue;
1093
+ }[];
1094
+ }
1095
+ /** A `TimelineTrack` as data. */
1096
+ interface ClipTimelineTrack {
1097
+ kind: 'timeline';
1098
+ label?: string;
1099
+ at: number;
1100
+ timeline: ClipTimeline;
1101
+ }
1102
+ /** Any track a clip can hold. */
1103
+ type ClipTrack = ClipSampledTrack | ClipEventTrack | ClipTimelineTrack;
1104
+ /** A `NestedTimeline` as data. */
1105
+ interface ClipTimeline {
1106
+ tracks: ClipTrack[];
1107
+ duration?: number;
1108
+ }
1109
+ /** A timeline as data: what `JSON.stringify` can write, `bindClip` can play, and `toClip`
1110
+ * can read back off a live timeline. */
1111
+ interface Clip extends ClipTimeline {
1112
+ version: 1;
1113
+ }
1114
+ /** What turns the names in a clip into the live things a timeline plays. */
1115
+ interface ClipBinder {
1116
+ /** The target a sampled track names. */
1117
+ target?(name: string): Target<any> | undefined;
1118
+ /** Interpolations by name. */
1119
+ interpolate?: Readonly<Record<string, Interpolate<any>>>;
1120
+ /** What an event does: its `fire`, its `book`, or both. */
1121
+ event?(name: string, data: ClipValue | undefined): Pick<TimelineEvent, 'fire' | 'book'> | undefined;
1122
+ }
1123
+ /**
1124
+ * The live timeline a clip describes, for `animator.timeline`: each sampled track given the
1125
+ * target and interpolation it names, each event what the binder says it does. The tracks
1126
+ * keep those names, so `toClip` can write them back after an editor has changed them.
1127
+ * Throws on a name the binder does not resolve.
1128
+ */
1129
+ declare function bindClip(clip: Clip, binder: ClipBinder): NestedTimeline;
1130
+ /**
1131
+ * A live timeline as a clip: `{ tracks, duration }` as `animator.timeline` takes them, or
1132
+ * `{ tracks: handle.tracks() }` off a running one. Each track is written by the names it
1133
+ * carries (`targetName`, `interpolateName`, an event's `name`), which `bindClip` sets and a
1134
+ * track written by hand can set too. Throws, naming the track, on anything a clip cannot
1135
+ * hold: a function with no name, an `onTick`, or a value JSON would not read back.
1136
+ */
1137
+ declare function toClip(timeline: NestedTimeline): Clip;
1138
+
1139
+ /** A joint's local transform. Deliberately NOT the scene's generic `TPose`:
1140
+ * `TPose` is consumer-defined and may be a bare AABB with no rotation term,
1141
+ * which a joint chain cannot compose through. */
1142
+ interface JointTransform {
1143
+ x: number;
1144
+ y: number;
1145
+ /** Radians. */
1146
+ rotation: number;
1147
+ scaleX: number;
1148
+ scaleY: number;
1149
+ }
1150
+ /** One joint of a `Skeleton`. */
1151
+ interface Joint {
1152
+ name: string;
1153
+ /** Parent joint name, or null for a root. */
1154
+ parent: string | null;
1155
+ /** Local transform at rest. */
1156
+ bind: JointTransform;
1157
+ }
1158
+ /** Joints in topological order: every joint appears after its parent. */
1159
+ interface Skeleton {
1160
+ joints: Joint[];
1161
+ }
1162
+ /** Local deltas from the bind pose, keyed by joint name. Absent joints and
1163
+ * absent fields mean "no change from bind". */
1164
+ type Pose = Record<string, Partial<JointTransform>>;
1165
+ /** The transform that changes nothing: origin, no rotation, unit scale. */
1166
+ declare const IDENTITY_JOINT: JointTransform;
1167
+
1168
+ /**
1169
+ * `pose` reflected across the rig's y axis, as deltas against the same
1170
+ * skeleton — so the mirrored pose still blends, samples and resolves like any
1171
+ * other.
1172
+ *
1173
+ * Reflecting a joint chain is conjugation: every local transform `T·R·S`
1174
+ * becomes `F·T·R·S·F` with `F` the flip, which is again a plain transform
1175
+ * with `x` and `rotation` negated. Every resolved joint is then exactly the
1176
+ * original's reflection, which is how a rig faces the other way without a
1177
+ * negative scale anywhere — a scene pose such as `RectPose` has no term to
1178
+ * carry one. The negation applies to bind plus delta, so the delta for a
1179
+ * joint the pose leaves at its bind is nonzero whenever the bind is.
1180
+ *
1181
+ * Applying it twice gives the original pose back.
1182
+ */
1183
+ declare function mirrorPose(skeleton: Skeleton, pose: Pose): Pose;
1184
+
1185
+ /**
1186
+ * Resolve every joint's world transform by walking the skeleton once and
1187
+ * composing each joint onto its already-resolved parent.
1188
+ *
1189
+ * `skeleton.joints` must be in topological order — a joint whose parent has not
1190
+ * been resolved yet throws rather than silently resolving against identity,
1191
+ * because that failure is otherwise invisible until a limb renders in the wrong
1192
+ * place.
1193
+ */
1194
+ declare function resolveSkeleton(skeleton: Skeleton, pose: Pose): Map<string, GlMat3>;
1195
+
1196
+ /**
1197
+ * The axes of `skeletonAxes(skeleton)` that belong to `joints`, for a hold or a track over part
1198
+ * of a rig: `animator.hold({ target: rig.target, value: pose, axes: jointAxes(skeleton, arm) })`.
1199
+ */
1200
+ declare function jointAxes(skeleton: Skeleton, joints: readonly string[]): number[];
1201
+ /**
1202
+ * How a {@link Pose} of `skeleton` maps to the numbers an animation moves: five per joint in
1203
+ * skeleton order (`x`, `y`, `rotation`, `scaleX`, `scaleY`), every rotation an angle, so a pose
1204
+ * blends the short way round. A joint or field the pose leaves out reads as its identity, and a
1205
+ * pose read back names every joint in full. Pass it as `axes` to `createTarget` for a pose target
1206
+ * of your own; a bound rig's is `Rig.target`.
1207
+ */
1208
+ declare function skeletonAxes(skeleton: Skeleton): TargetAxes<Pose>;
1209
+
1210
+ /** A point in the skeleton's space — the space `resolveSkeleton` resolves into. */
1211
+ interface IkPoint {
1212
+ x: number;
1213
+ y: number;
1214
+ }
1215
+ /** Bounds on a joint's rotation delta from its bind, in radians, with
1216
+ * `-PI <= min <= max <= PI`. */
1217
+ interface IkLimit {
1218
+ min: number;
1219
+ max: number;
1220
+ }
1221
+ /** Options for {@link solveIk}. */
1222
+ interface SolveIkOptions {
1223
+ /** The joints the solver may rotate, root first, each the parent of the next. */
1224
+ joints: readonly string[];
1225
+ /** The end effector, in the last joint's local frame — the forearm's length
1226
+ * along its +x for an arm, or a hand joint's bind offset. */
1227
+ tip: IkPoint;
1228
+ /** Where the tip should go, in skeleton space. A rig posed with a `root`
1229
+ * wants the target carried back through that root's inverse first. */
1230
+ target: IkPoint;
1231
+ /** Per-joint limits, keyed by joint name. A joint without one turns freely. */
1232
+ limits?: Readonly<Record<string, IkLimit>>;
1233
+ /** Two-joint chains only: the middle joint bends toward this point, in
1234
+ * skeleton space. Without it the chain keeps the bend the input pose has. */
1235
+ pole?: IkPoint;
1236
+ /** Most CCD sweeps to run. Default 32. */
1237
+ iterations?: number;
1238
+ /** Tip-to-target distance that counts as reached, in skeleton units.
1239
+ * Default 0.01. */
1240
+ tolerance?: number;
1241
+ }
1242
+ /** What {@link solveIk} returns. */
1243
+ interface IkResult {
1244
+ /** The input pose with each chain joint's rotation replaced. */
1245
+ pose: Pose;
1246
+ /** Tip-to-target distance the solve ended at. */
1247
+ distance: number;
1248
+ /** Whether `distance` is within the tolerance. False for a target out of
1249
+ * reach, which leaves the chain pointing straight at it. */
1250
+ reached: boolean;
1251
+ /** CCD sweeps run; 0 when the two-joint solution or the straight-line
1252
+ * answer for an unreachable target settled it. */
1253
+ iterations: number;
1254
+ }
1255
+ /**
1256
+ * Rotate a joint chain so its tip reaches `target`, returning the result as an
1257
+ * ordinary {@link Pose} — so it keys a `SampledTrack<Pose>`, drives a rig through
1258
+ * `Rig.pose`, and is held on a rig like any other. Weighting the IK against an
1259
+ * animated pose is `animator.hold({ target: rig.target, value: solved, weight: w })`
1260
+ * beside the clip at weight `1 - w`; with `axes: jointAxes(skeleton, joints)` on both, the
1261
+ * rest of the body is left to whatever else holds it.
1262
+ *
1263
+ * The solver is cyclic coordinate descent: each step turns one joint so the
1264
+ * tip lies on the ray from that joint to the target. A joint's rotation is the
1265
+ * one term the rig lets it change, and a CCD step is exactly a change to it, so
1266
+ * limits clamp the value the pose stores and nothing has to be converted back
1267
+ * from positions. Each step is solved in the joint's parent frame, which makes
1268
+ * it exact under any parent transform the skeleton composes, mirrors included.
1269
+ *
1270
+ * A two-joint chain is solved analytically first: of the two bends that reach
1271
+ * the target it takes the one on `pole`'s side, or the input pose's side, and
1272
+ * falls back to the other bend and then to CCD when limits refuse it. A target
1273
+ * beyond the chain's reach straightens the chain toward it.
1274
+ */
1275
+ declare function solveIk(skeleton: Skeleton, pose: Pose, options: SolveIkOptions): IkResult;
1276
+
1277
+ /**
1278
+ * How much each point of a path follows each joint: one array per joint name, indexed by
1279
+ * point. Point `i` is the `i`-th coordinate pair of a polygon path's `coords`, so anchors and
1280
+ * curve handles are weighted alike; a rect's points are its corners, clockwise from the top
1281
+ * left. A joint left out, and an index past an array's end, weigh nothing. Weights need not
1282
+ * sum to 1: they are normalized per point as they are applied.
1283
+ */
1284
+ type Skin = Readonly<Record<string, readonly number[]>>;
1285
+ /**
1286
+ * Each joint's motion since the bind pose, in world space: `world * inverse(restWorld)`.
1287
+ * `world` is what `resolveSkeleton` or `Rig.world()` answers.
1288
+ */
1289
+ declare function motionsFromRest(skeleton: Skeleton, world: ReadonlyMap<string, GlMat3>): Map<string, GlMat3>;
1290
+ /** The path whose points a skin indexes: a rect as its four corners. */
1291
+ declare function skinnable(path: Path): PolygonPath;
1292
+ /**
1293
+ * Bend `path` by linear blend skinning: each point goes where its joints' motions since the
1294
+ * bind pose would carry it, averaged by weight. `path` is the shape at the bind pose, in the
1295
+ * space `motions` are in; it is not modified. A point no joint weighs stays where it is.
1296
+ */
1297
+ declare function skinPath(path: Path, skin: Skin, motions: ReadonlyMap<string, GlMat3>): PolygonPath;
1298
+
1299
+ /** Options for `autoSkin`. */
1300
+ interface AutoSkinOptions {
1301
+ /** How fast a bone's pull falls off with distance: a weight is `1 / distance ** power`.
1302
+ * Higher keeps the bend closer to the joint. Default 4. */
1303
+ power?: number;
1304
+ /** The most joints a point follows; the nearest are kept. Default 2. */
1305
+ max?: number;
1306
+ }
1307
+ /**
1308
+ * Weights for `path` from how far each of its points is from each bone of `skeleton` at the
1309
+ * bind pose. `path` is in the skeleton's space. A point on a bone follows that bone alone.
1310
+ */
1311
+ declare function autoSkin(path: Path, skeleton: Skeleton, options?: AutoSkinOptions): Skin;
1312
+
1313
+ /** Where each joint rests, in the skeleton's space and in its order. */
1314
+ declare function jointPositions(skeleton: Skeleton): Map<string, {
1315
+ x: number;
1316
+ y: number;
1317
+ }>;
1318
+ /** The joint resting nearest `(x, y)` and no further than `reach` from it, or `null`. */
1319
+ declare function jointAt(skeleton: Skeleton, x: number, y: number, reach: number): string | null;
1320
+ /** `skeleton` with `name` resting at `(x, y)`. The joints under it keep their offsets from it,
1321
+ * so they move along. */
1322
+ declare function moveJoint(skeleton: Skeleton, name: string, x: number, y: number): Skeleton;
1323
+ /** `skeleton` with a new joint resting at `(x, y)` under `parent`, or as a root for `null`.
1324
+ * Without a `name` it gets the first of `joint`, `joint2`, … not in use. */
1325
+ declare function addJoint(skeleton: Skeleton, parent: string | null, x: number, y: number, name?: string): {
1326
+ skeleton: Skeleton;
1327
+ name: string;
1328
+ };
1329
+ /** `skeleton` without `name` and the joints under it, and the names that went. */
1330
+ declare function removeJoint(skeleton: Skeleton, name: string): {
1331
+ skeleton: Skeleton;
1332
+ removed: string[];
1333
+ };
1334
+ /** `skin` without the weights of `joints`; the same object when it weighs none of them. */
1335
+ declare function dropSkinJoints(skin: Skin, joints: readonly string[]): Skin;
1336
+
1337
+ /**
1338
+ * `skin` with `joint`'s weight set on some points: `weights` maps a point's index to the new
1339
+ * weight, clamped to 0..1. On each of those points the other joints are scaled to share what
1340
+ * is left, so the point still sums to 1; a point no other joint weighs goes wholly to `joint`,
1341
+ * as it would when the skin is applied. Every array comes back `count` long, and a joint left
1342
+ * weighing nothing is dropped.
1343
+ */
1344
+ declare function setWeights(skin: Skin, count: number, joint: string, weights: ReadonlyMap<number, number>): Skin;
1345
+ /**
1346
+ * What a round brush at `(x, y)` does to one joint's weights: for each point of `coords`
1347
+ * within `radius`, a weight falling off linearly from the center. `'add'` raises a point
1348
+ * toward 1 and `'remove'` lowers it toward 0; neither moves a point the other way. Answers
1349
+ * only the points that change, by index, for {@link setWeights}.
1350
+ */
1351
+ declare function brushWeights(coords: ArrayLike<number>, x: number, y: number, radius: number, current: readonly number[] | undefined, mode: 'add' | 'remove'): Map<number, number>;
1352
+
1353
+ export { type AnimationHandle, type AnimationInfo, type AnimationKind, type Animator, type AnimatorEvent, type AnimatorListener, type AutoSkinOptions, type Axes, type AxisBuffer, type Clip, type ClipBinder, type ClipEventTrack, type ClipKey, type ClipSampledTrack, type ClipTimeline, type ClipTimelineTrack, type ClipTrack, type ClipValue, type ColorInterpolate, type ColorOverride, type ColorOverrideFn, ColorOverrideRegistry, type CycleHandle, type CycleVertexColorsOptions, type DecayOptions, type EventBooking, type EventBookingHandle, type EventTrack, type HoldHandle, type HoldOptions, IDENTITY_JOINT, type IkLimit, type IkPoint, type IkResult, type Interpolate, type InterpolatorFactory, type Joint, type JointTransform, type Keyframe, type LiveAnimation, type LoopFactory, type LoopOptions, type NestedTimeline, type PhysicsHandle, type PhysicsOptions, type Pose, type SampledTrack, type Skeleton, type Skin, type Slew, type SlewRates, type SolveIkOptions, type SpringOptions, type SpringVertexColorsOptions, type StaggerBuilder, type StaggerDelay, type StaggerFactory, type StaggerOptions, type StaggerPerItem, type StaggerTweenOptions, type StaggerVertexColorsOptions, type Target, type TargetAxes, type TargetDecayOptions, type TargetOptions, type TargetPhysicsOptions, type TargetSpringOptions, type TargetTable, type TargetTableOptions, type TargetTweenOptions, type TimelineClock, type TimelineEvent, type TimelineHandle, type TimelineOptions, type TimelineTrack, type Track, type TweenLoopOptions, type TweenOptions, type TweenVertexColorsOptions, type UseAnimatorOptions, type VertexColorChannel, addJoint, autoSkin, axesOf, bindClip, brushWeights, createSlew, createTarget, createTargetTable, cycleVertexColors, dropSkinJoints, jointAt, jointAxes, jointPositions, mirrorPose, motionsFromRest, moveJoint, rainbowVertexColors, removeJoint, resolveSkeleton, sampleTrack, setWeights, skeletonAxes, skinPath, skinnable, slewToward, solidVertexColors, solveIk, springVertexColors, staggerVertexColors, toClip, tweenVertexColors, useAnimator };