@mkbabb/keyframes.js 2.1.1 → 3.0.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.
- package/LICENSE +1 -1
- package/README.md +36 -1
- package/dist/css-easing-DoPNckiS.js +55 -0
- package/dist/engine-B7JGZTdU.js +742 -0
- package/dist/keyframes.d.ts +213 -38
- package/dist/keyframes.js +108 -787
- package/package.json +10 -4
- package/dist/_redirects +0 -1
package/dist/keyframes.d.ts
CHANGED
|
@@ -76,6 +76,7 @@ declare class Animation_2<V extends Vars = any> {
|
|
|
76
76
|
setDirection(direction: InputAnimationOptions["direction"]): this;
|
|
77
77
|
setFillMode(fillMode: InputAnimationOptions["fillMode"]): this;
|
|
78
78
|
setUseWAAPI(useWAAPI: InputAnimationOptions["useWAAPI"]): this;
|
|
79
|
+
setRespectReducedMotion(respectReducedMotion: InputAnimationOptions["respectReducedMotion"]): this;
|
|
79
80
|
setColorSpace(colorSpace: InputAnimationOptions["colorSpace"]): this;
|
|
80
81
|
setHueMethod(hueMethod: InputAnimationOptions["hueMethod"]): this;
|
|
81
82
|
setOptions(options: Partial<InputAnimationOptions>): this;
|
|
@@ -120,6 +121,13 @@ declare class Animation_2<V extends Vars = any> {
|
|
|
120
121
|
* before this is invoked, and runtime errors propagate.
|
|
121
122
|
*/
|
|
122
123
|
private _playWAAPI;
|
|
124
|
+
/**
|
|
125
|
+
* `prefers-reduced-motion` snap: jump to the final frame in a single
|
|
126
|
+
* paint — no rAF/WAAPI loop. The lifecycle stays observable
|
|
127
|
+
* (`animationstart` → fill final → `animationend`) so consumers' event
|
|
128
|
+
* wiring is identical to a completed normal play.
|
|
129
|
+
*/
|
|
130
|
+
private _playReducedMotion;
|
|
123
131
|
play(): Promise<void>;
|
|
124
132
|
pause(draw?: boolean): this;
|
|
125
133
|
resume(): this;
|
|
@@ -133,6 +141,27 @@ declare class Animation_2<V extends Vars = any> {
|
|
|
133
141
|
}
|
|
134
142
|
export { Animation_2 as Animation }
|
|
135
143
|
|
|
144
|
+
/**
|
|
145
|
+
* The value.js-bearing engine surface, resolved through `loadAnimationEngine()`.
|
|
146
|
+
*
|
|
147
|
+
* Spelled as an explicit interface (rather than `typeof import("./engine")`)
|
|
148
|
+
* because the dts roll-up — API Extractor — cannot resolve a `typeof import()`
|
|
149
|
+
* type node that points at an internal module. The shape stays in lockstep
|
|
150
|
+
* with `./engine`'s runtime exports.
|
|
151
|
+
*/
|
|
152
|
+
export declare interface AnimationEngine {
|
|
153
|
+
Animation: typeof Animation_2;
|
|
154
|
+
CSSKeyframesAnimation: typeof CSSKeyframesAnimation;
|
|
155
|
+
AnimationGroup: typeof AnimationGroup;
|
|
156
|
+
getAnimationId: (animation: Animation_2 | string) => string;
|
|
157
|
+
getTimingFunction: (timingFunction: TimingFunction | TimingFunctionNames | string | undefined) => TimingFunction | undefined;
|
|
158
|
+
resolveKeyframes: (input: string | Stylesheet) => ResolvedKeyframes;
|
|
159
|
+
DIRECTIONS: readonly AnimationOptions["direction"][];
|
|
160
|
+
FILL_MODES: readonly AnimationOptions["fillMode"][];
|
|
161
|
+
defaultOptions: AnimationOptions;
|
|
162
|
+
defaultLayerConfig: AnimationLayerConfig;
|
|
163
|
+
}
|
|
164
|
+
|
|
136
165
|
export declare interface AnimationFrame<V extends Vars> {
|
|
137
166
|
id: number;
|
|
138
167
|
start: ValueUnit;
|
|
@@ -166,6 +195,19 @@ export declare class AnimationGroup<V extends Vars> {
|
|
|
166
195
|
paused: boolean;
|
|
167
196
|
started: boolean;
|
|
168
197
|
done: boolean;
|
|
198
|
+
/**
|
|
199
|
+
* When true, `play()` honors `prefers-reduced-motion: reduce` by snapping
|
|
200
|
+
* every child to its final frame in a single composite instead of running
|
|
201
|
+
* the rAF draw loop. SSR-safe no-op off-DOM. Default false.
|
|
202
|
+
*/
|
|
203
|
+
respectReducedMotion: boolean;
|
|
204
|
+
/**
|
|
205
|
+
* Children-per-slice before `tick()` yields to the main thread. Groups at
|
|
206
|
+
* or under this size tick in one slice (fast path); larger groups tick in
|
|
207
|
+
* batches with a `scheduler.yield()` between them so a big per-frame
|
|
208
|
+
* composite doesn't run as one long task (INP relief).
|
|
209
|
+
*/
|
|
210
|
+
static readonly YIELD_BATCH = 32;
|
|
169
211
|
singleTarget: boolean;
|
|
170
212
|
lastTickTime: number;
|
|
171
213
|
handleId: number | any;
|
|
@@ -231,6 +273,8 @@ export declare class AnimationGroup<V extends Vars> {
|
|
|
231
273
|
* (startTime, this.t) resolve before interpFrames reads them.
|
|
232
274
|
*/
|
|
233
275
|
tick(t: number): Promise<this>;
|
|
276
|
+
/** Advance one slice of children to timestamp `t`, awaiting their ticks together. */
|
|
277
|
+
private _tickSlice;
|
|
234
278
|
/**
|
|
235
279
|
* Main animation frame callback. Ticks all children, then renders
|
|
236
280
|
* (single-target: grouped blending; multi-target: per-child).
|
|
@@ -240,8 +284,26 @@ export declare class AnimationGroup<V extends Vars> {
|
|
|
240
284
|
/**
|
|
241
285
|
* Start the animation group. Returns a promise that resolves
|
|
242
286
|
* when all child animations complete (or on explicit stop/reset).
|
|
287
|
+
*
|
|
288
|
+
* Under `respectReducedMotion` + an active `prefers-reduced-motion`
|
|
289
|
+
* query, snaps every child to its final frame in a single composite —
|
|
290
|
+
* no rAF draw loop — then settles exactly as a completed play would.
|
|
243
291
|
*/
|
|
244
292
|
play(): Promise<unknown>;
|
|
293
|
+
/**
|
|
294
|
+
* `prefers-reduced-motion` snap for the group: advance every child to its
|
|
295
|
+
* final frame, composite a single paint, then settle child + group state
|
|
296
|
+
* for replay — no rAF loop, no motion. The final frame STAYS on the
|
|
297
|
+
* target(s): reduced motion shows the END state, matching
|
|
298
|
+
* `Animation._playReducedMotion`.
|
|
299
|
+
*
|
|
300
|
+
* Deliberately does NOT route through `reset()` — `reset()` repaints every
|
|
301
|
+
* child to frame 0 (`interpFrames(0, true)`, the fillBackwards
|
|
302
|
+
* cube-cutoff workaround), which would clobber the snapped final frame and
|
|
303
|
+
* leave, e.g., a `fadeIn` group invisible. The child `Animation.reset()`
|
|
304
|
+
* clears state flags only and does not repaint, so it is safe here.
|
|
305
|
+
*/
|
|
306
|
+
private _playReducedMotion;
|
|
245
307
|
/**
|
|
246
308
|
* Toggle pause state. Calling pause() when playing pauses; calling
|
|
247
309
|
* pause() when paused resumes. (Toggle semantics preserved for
|
|
@@ -269,7 +331,7 @@ export declare class AnimationGroup<V extends Vars> {
|
|
|
269
331
|
getLayerConfig(nameOrAnim: string | Animation_2<V>): AnimationLayerConfig | undefined;
|
|
270
332
|
}
|
|
271
333
|
|
|
272
|
-
declare interface AnimationGroupEntry<V extends Vars> {
|
|
334
|
+
export declare interface AnimationGroupEntry<V extends Vars> {
|
|
273
335
|
animation: Animation_2<V>;
|
|
274
336
|
values: Record<string, unknown>;
|
|
275
337
|
layer: AnimationLayerConfig;
|
|
@@ -306,6 +368,13 @@ export declare type AnimationOptions = {
|
|
|
306
368
|
fillMode: (typeof FILL_MODES)[number];
|
|
307
369
|
timingFunction: TimingFunction;
|
|
308
370
|
useWAAPI: boolean;
|
|
371
|
+
/**
|
|
372
|
+
* When true, honor `prefers-reduced-motion: reduce` by snapping the
|
|
373
|
+
* `Animation`/`AnimationGroup` `play()` path to the final frame in a
|
|
374
|
+
* single paint instead of running the rAF/WAAPI loop. SSR-safe no-op
|
|
375
|
+
* off-DOM. Default false (consumers opt in).
|
|
376
|
+
*/
|
|
377
|
+
respectReducedMotion: boolean;
|
|
309
378
|
colorSpace: ColorSpace;
|
|
310
379
|
hueMethod?: HueInterpolationMethod;
|
|
311
380
|
};
|
|
@@ -328,11 +397,7 @@ export declare class CSSKeyframesAnimation<V extends Vars> extends Animation_2<V
|
|
|
328
397
|
transform(vars: V): void;
|
|
329
398
|
}
|
|
330
399
|
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
export declare const defaultOptions: AnimationOptions;
|
|
334
|
-
|
|
335
|
-
export declare const DIRECTIONS: readonly ["normal", "reverse", "alternate", "alternate-reverse"];
|
|
400
|
+
declare const DIRECTIONS: readonly ["normal", "reverse", "alternate", "alternate-reverse"];
|
|
336
401
|
|
|
337
402
|
/**
|
|
338
403
|
* Interpolate position and scale between two elements or rects.
|
|
@@ -350,6 +415,14 @@ export declare class ElementMorph {
|
|
|
350
415
|
constructor(from: HTMLElement | MorphRect, to: HTMLElement | MorphRect, options?: ElementMorphOptions);
|
|
351
416
|
/** Re-measure source and destination, rebuilding the internal animation. */
|
|
352
417
|
measure(from: HTMLElement | MorphRect, to: HTMLElement | MorphRect): this;
|
|
418
|
+
/**
|
|
419
|
+
* Resolve a pending string easing *name* through the dynamic engine
|
|
420
|
+
* boundary. No-op for callable / omitted easing. Stateless `.at()` /
|
|
421
|
+
* `.toCSSTransform()` consumers that pass a name can `await .ready()`
|
|
422
|
+
* first to interpolate with the resolved easing; `.play()` awaits it
|
|
423
|
+
* automatically before the first frame.
|
|
424
|
+
*/
|
|
425
|
+
ready(): Promise<void>;
|
|
353
426
|
/** Get raw transform values at the given progress [0, 1]. */
|
|
354
427
|
at(progress: number): MorphValues;
|
|
355
428
|
/** Get a CSS transform string at the given progress [0, 1]. */
|
|
@@ -368,34 +441,20 @@ export declare class ElementMorph {
|
|
|
368
441
|
}
|
|
369
442
|
|
|
370
443
|
export declare interface ElementMorphOptions {
|
|
444
|
+
/**
|
|
445
|
+
* Easing as a callable `TimingFunction`, OR a string easing *name*
|
|
446
|
+
* from value.js's registry (`"ease-out-cubic"`, `"easeOutCubic"`, …).
|
|
447
|
+
* `ElementMorph` composes `NumericAnimation`, so a callable keeps the
|
|
448
|
+
* path value.js-free while a string name resolves LAZILY through the
|
|
449
|
+
* dynamic engine boundary on the first `.play()` (or `await .ready()`).
|
|
450
|
+
*/
|
|
371
451
|
timingFunction?: TimingFunction | TimingFunctionNames;
|
|
372
452
|
/** Playback duration in milliseconds. Required for `.play()`. */
|
|
373
453
|
duration?: number;
|
|
374
454
|
transformOrigin?: string;
|
|
375
455
|
}
|
|
376
456
|
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
export declare const getAnimationId: (animation: Animation_2 | string) => string;
|
|
380
|
-
|
|
381
|
-
/**
|
|
382
|
-
* Resolve a timing-function input to a callable `TimingFunction`.
|
|
383
|
-
*
|
|
384
|
-
* Accepts:
|
|
385
|
-
* - a `TimingFunction` — returned as-is
|
|
386
|
-
* - a named entry in `timingFunctions` (`ease-out-cubic`,
|
|
387
|
-
* `easeOutCubic`, `linear`, etc.) — looked up in the registry
|
|
388
|
-
* - a CSS `cubic-bezier(x1, y1, x2, y2)` literal string —
|
|
389
|
-
* parsed to control points and resolved via `CSSCubicBezier`
|
|
390
|
-
* - `undefined` or a name/literal the registry can't find —
|
|
391
|
-
* returns `undefined` so callers can fall back to their
|
|
392
|
-
* default (usually `easeInOutCubic`)
|
|
393
|
-
*
|
|
394
|
-
* Higher-arity factory entries (`steps`, `step-start`, `step-end`)
|
|
395
|
-
* live in the registry but require construction arguments; they
|
|
396
|
-
* return `undefined` here so callers can invoke them explicitly.
|
|
397
|
-
*/
|
|
398
|
-
export declare const getTimingFunction: (timingFunction: TimingFunction | TimingFunctionNames | string | undefined) => TimingFunction | undefined;
|
|
457
|
+
declare const FILL_MODES: readonly ["none", "forwards", "backwards", "both"];
|
|
399
458
|
|
|
400
459
|
export declare type InputAnimationOptions = Partial<{
|
|
401
460
|
duration: number | string;
|
|
@@ -406,12 +465,34 @@ export declare type InputAnimationOptions = Partial<{
|
|
|
406
465
|
timingFunction: TimingFunction | TimingFunctionNames | undefined;
|
|
407
466
|
/** When true (default), eligible animations may use the Web Animations API for compositor-thread execution. Set to false to force rAF. */
|
|
408
467
|
useWAAPI: boolean;
|
|
468
|
+
/** When true, snap `play()` to the final frame under `prefers-reduced-motion: reduce`. Default false. */
|
|
469
|
+
respectReducedMotion: boolean;
|
|
409
470
|
colorSpace?: ColorSpace;
|
|
410
471
|
hueMethod?: HueInterpolationMethod;
|
|
411
472
|
}>;
|
|
412
473
|
|
|
413
474
|
export { InterpolatedVar }
|
|
414
475
|
|
|
476
|
+
/**
|
|
477
|
+
* Load the heavy CSS-keyframe parsing engine — `Animation`,
|
|
478
|
+
* `CSSKeyframesAnimation`, `AnimationGroup`, `getTimingFunction`,
|
|
479
|
+
* `resolveKeyframes`, and the animation-options constants (`DIRECTIONS`,
|
|
480
|
+
* `FILL_MODES`, `defaultOptions`, `defaultLayerConfig`).
|
|
481
|
+
*
|
|
482
|
+
* This is the dynamic boundary: the `import("./engine")` pulls value.js into
|
|
483
|
+
* the consumer's graph only when first awaited, so a light-only consumer
|
|
484
|
+
* (spring / smooth / numeric / morph / timeline) never loads it.
|
|
485
|
+
*
|
|
486
|
+
* ```ts
|
|
487
|
+
* const { CSSKeyframesAnimation } = await loadAnimationEngine();
|
|
488
|
+
* const anim = new CSSKeyframesAnimation(opts).fromString(css);
|
|
489
|
+
* ```
|
|
490
|
+
*
|
|
491
|
+
* The browser caches the dynamic module after the first load, so repeat
|
|
492
|
+
* calls resolve from the module cache without a second fetch.
|
|
493
|
+
*/
|
|
494
|
+
export declare const loadAnimationEngine: () => Promise<AnimationEngine>;
|
|
495
|
+
|
|
415
496
|
export declare class ManualTimeline extends Timeline {
|
|
416
497
|
private value;
|
|
417
498
|
constructor(options?: TimelineOptions);
|
|
@@ -451,14 +532,27 @@ export declare class NumericAnimation<T extends Record<string, number>> {
|
|
|
451
532
|
private keyframes;
|
|
452
533
|
private segments;
|
|
453
534
|
private positions;
|
|
454
|
-
private timingFn;
|
|
455
535
|
private result;
|
|
456
536
|
private _duration;
|
|
457
537
|
private _respectReducedMotion;
|
|
538
|
+
private _easing;
|
|
458
539
|
private _playback;
|
|
459
540
|
constructor(keyframes: T[], options?: NumericAnimationOptions);
|
|
460
541
|
private buildSegments;
|
|
461
542
|
private buildSegment;
|
|
543
|
+
/**
|
|
544
|
+
* Resolve a pending string easing *name* through the dynamic engine
|
|
545
|
+
* boundary. A no-op (resolved promise) when easing was supplied as a
|
|
546
|
+
* callable or omitted. Memoized via the shared `EasingResolvable` — the
|
|
547
|
+
* `await import("./engine")` and `getTimingFunction` lookup run at most
|
|
548
|
+
* once per instance.
|
|
549
|
+
*
|
|
550
|
+
* Resolution is already kicked off eagerly at construction; `.play()`
|
|
551
|
+
* awaits this before the first frame, and stateless `.at()` consumers
|
|
552
|
+
* that pass a name can `await animation.ready()` first to interpolate
|
|
553
|
+
* with the resolved easing rather than the identity fallback.
|
|
554
|
+
*/
|
|
555
|
+
ready(): Promise<void>;
|
|
462
556
|
/**
|
|
463
557
|
* Map [0, 1] progress to interpolated values. Zero allocation —
|
|
464
558
|
* returns the same pre-allocated result object on every call.
|
|
@@ -485,6 +579,24 @@ export declare class NumericAnimation<T extends Record<string, number>> {
|
|
|
485
579
|
}
|
|
486
580
|
|
|
487
581
|
export declare interface NumericAnimationOptions {
|
|
582
|
+
/**
|
|
583
|
+
* Easing as a callable `TimingFunction`, OR a string easing *name*
|
|
584
|
+
* from value.js's registry (`"ease-out-cubic"`, `"easeOutCubic"`,
|
|
585
|
+
* `"linear"`, …).
|
|
586
|
+
*
|
|
587
|
+
* A **callable** is used directly and keeps this engine value.js-free —
|
|
588
|
+
* no dynamic import, nothing pulled into the static graph.
|
|
589
|
+
*
|
|
590
|
+
* A **string name** is resolved through the dynamic engine boundary via
|
|
591
|
+
* the shared `EasingResolvable` contract: resolution is kicked off
|
|
592
|
+
* EAGERLY at construction (an `await import("./engine")` looks the name
|
|
593
|
+
* up via `getTimingFunction`), so the value.js-bearing easing registry
|
|
594
|
+
* loads only when a named easing is actually used and the named curve
|
|
595
|
+
* lands by the first frame. Until it lands, `.at()` interpolates with the
|
|
596
|
+
* identity fallback and emits a one-time dev-only warning; `await
|
|
597
|
+
* .ready()` first to interpolate with the named curve from the very first
|
|
598
|
+
* synchronous `.at()`.
|
|
599
|
+
*/
|
|
488
600
|
timingFunction?: TimingFunction | TimingFunctionNames | undefined;
|
|
489
601
|
/** Playback duration in milliseconds. Required for `.play()`. */
|
|
490
602
|
duration?: number | undefined;
|
|
@@ -507,6 +619,55 @@ export declare type NumericFrameCallback<T extends Record<string, number>> = (va
|
|
|
507
619
|
|
|
508
620
|
declare type ParsedVarMap = Record<string, ValueArray>;
|
|
509
621
|
|
|
622
|
+
/**
|
|
623
|
+
* Shared rAF playback lifecycle for stateless interpolators
|
|
624
|
+
* (`NumericAnimation`, `ElementMorph`). Owns the rAF handle, start
|
|
625
|
+
* timestamp, resolve callback, AND the `prefers-reduced-motion` gate so the
|
|
626
|
+
* interpolator classes don't each reimplement the same loop or the same
|
|
627
|
+
* reduced-motion snap.
|
|
628
|
+
*
|
|
629
|
+
* Not used by the full `Animation` class — that engine has a richer
|
|
630
|
+
* lifecycle (iteration, direction, fill modes, events) that doesn't
|
|
631
|
+
* factor into this primitive; it carries its own reduced-motion snap.
|
|
632
|
+
*/
|
|
633
|
+
export declare class RAFPlayback {
|
|
634
|
+
private _rafId;
|
|
635
|
+
private _startTime;
|
|
636
|
+
private _resolve;
|
|
637
|
+
/**
|
|
638
|
+
* Drive `onTick(progress)` once per frame for `duration` ms.
|
|
639
|
+
* `progress` is clamped to [0, 1]; the loop terminates after the
|
|
640
|
+
* frame at `progress === 1`. The returned promise resolves when
|
|
641
|
+
* the animation completes naturally or is interrupted by `stop()`.
|
|
642
|
+
*
|
|
643
|
+
* Under `options.respectReducedMotion` + an active
|
|
644
|
+
* `prefers-reduced-motion: reduce` query, snaps to the final frame —
|
|
645
|
+
* `onTick(1)` fires once, no rAF loop is spawned, and the promise
|
|
646
|
+
* resolves on the next microtask.
|
|
647
|
+
*/
|
|
648
|
+
play(duration: number, onTick: (progress: number) => void, options?: RAFPlaybackOptions): Promise<void>;
|
|
649
|
+
/** Cancel a running playback. The play promise resolves immediately. */
|
|
650
|
+
stop(): void;
|
|
651
|
+
private _cleanup;
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
/** Per-playback options for {@link RAFPlayback.play}. */
|
|
655
|
+
declare interface RAFPlaybackOptions {
|
|
656
|
+
/**
|
|
657
|
+
* Honor `prefers-reduced-motion: reduce` by snapping to the final frame
|
|
658
|
+
* (`onTick(1)`) in a single paint instead of running the rAF loop. The
|
|
659
|
+
* returned promise resolves on the next microtask. Default false.
|
|
660
|
+
*
|
|
661
|
+
* This is THE shared reduced-motion gate for the light managed-playback
|
|
662
|
+
* surface: `NumericAnimation` (and `ElementMorph`, which composes it)
|
|
663
|
+
* route their `respectReducedMotion` option straight through here, so the
|
|
664
|
+
* snap lives in one place rather than re-implemented per interpolator.
|
|
665
|
+
* SSR-safe — off-DOM `prefersReducedMotion()` is false, so playback runs
|
|
666
|
+
* normally.
|
|
667
|
+
*/
|
|
668
|
+
respectReducedMotion?: boolean | undefined;
|
|
669
|
+
}
|
|
670
|
+
|
|
510
671
|
/**
|
|
511
672
|
* Result of normalising a CSS keyframes input down to the shape the
|
|
512
673
|
* `CSSKeyframesAnimation.fromString` flow expects: a `Map<percent →
|
|
@@ -529,14 +690,6 @@ export declare interface ResolvedKeyframes {
|
|
|
529
690
|
options: ReturnType<typeof extractAnimationOptions>;
|
|
530
691
|
}
|
|
531
692
|
|
|
532
|
-
/**
|
|
533
|
-
* Normalise a CSS string (or pre-parsed Stylesheet) into the shape
|
|
534
|
-
* `CSSKeyframesAnimation.fromString` consumes. The single entry
|
|
535
|
-
* point: replaces the legacy `parseCSSKeyframes` /
|
|
536
|
-
* `parseCSSStyleBlock` / `parseCSSAnimationKeyframes` fork.
|
|
537
|
-
*/
|
|
538
|
-
export declare const resolveKeyframes: (input: string | Stylesheet) => ResolvedKeyframes;
|
|
539
|
-
|
|
540
693
|
declare class ScrollTimeline_2 extends Timeline {
|
|
541
694
|
private threshold;
|
|
542
695
|
private getScrollY;
|
|
@@ -893,10 +1046,18 @@ export declare interface TemplateAnimationFrame<V extends Vars> {
|
|
|
893
1046
|
|
|
894
1047
|
export declare abstract class Timeline {
|
|
895
1048
|
private smoother;
|
|
896
|
-
private
|
|
1049
|
+
private _easing;
|
|
897
1050
|
private currentProgress;
|
|
898
1051
|
private boundaryEpsilon;
|
|
899
1052
|
constructor(options?: TimelineOptions);
|
|
1053
|
+
/**
|
|
1054
|
+
* Resolve a pending string easing *name* through the dynamic engine
|
|
1055
|
+
* boundary. No-op (resolved promise) for callable / omitted easing.
|
|
1056
|
+
* Resolution is already kicked off eagerly at construction; `await
|
|
1057
|
+
* timeline.ready()` before the first `tick()` to apply the eased value
|
|
1058
|
+
* immediately rather than letting it land asynchronously.
|
|
1059
|
+
*/
|
|
1060
|
+
ready(): Promise<void>;
|
|
900
1061
|
/** Subclass returns raw [0,1] progress from its source. */
|
|
901
1062
|
protected abstract sample(): number;
|
|
902
1063
|
/**
|
|
@@ -931,6 +1092,20 @@ export declare abstract class Timeline {
|
|
|
931
1092
|
}
|
|
932
1093
|
|
|
933
1094
|
export declare interface TimelineOptions {
|
|
1095
|
+
/**
|
|
1096
|
+
* Easing as a callable `TimingFunction`, OR a string easing *name*
|
|
1097
|
+
* from value.js's registry (`"ease-out-cubic"`, `"easeOutCubic"`, …).
|
|
1098
|
+
*
|
|
1099
|
+
* A **callable** is applied directly and keeps `Timeline` value.js-free.
|
|
1100
|
+
*
|
|
1101
|
+
* A **string name** is resolved through the dynamic engine boundary via
|
|
1102
|
+
* the shared `EasingResolvable` contract: the constructor kicks off an
|
|
1103
|
+
* eager `await import(...)` and the resolved easing is applied once it
|
|
1104
|
+
* lands (subsequent `tick()`s use it). Until then `tick()` runs with the
|
|
1105
|
+
* identity easing and emits a one-time dev-only warning. Consumers that
|
|
1106
|
+
* need the eased value on the very first `tick()` can
|
|
1107
|
+
* `await timeline.ready()` first.
|
|
1108
|
+
*/
|
|
934
1109
|
easing?: TimingFunction | TimingFunctionNames | undefined;
|
|
935
1110
|
/** SmoothProgress config. `false` disables smoothing. Default: enabled. */
|
|
936
1111
|
smoothing?: Partial<SmoothProgressOptions> | false | undefined;
|