@mkbabb/keyframes.js 1.2.0 → 1.2.1

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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # keyframes.js ![image](./assets/cube.png)
2
2
 
3
- CSS keyframe animations for anything in JavaScript. Specify your keyframes in standards-compliant CSS; animate any object, DOM element, or data structure.
3
+ CSS keyframe animations for anything in JavaScript. Specify your keyframes in standards-compliant CSS; animate any object, DOM element, or data structure. General-purpose interpolation primitives — smoothing, morphing, scroll-driven timelines — ship alongside.
4
4
 
5
5
  [Try the demo here!](https://keyframes.babb.dev/)
6
6
 
@@ -51,6 +51,12 @@ Plucked directly from the [`demo/simple`](demo/simple/App.vue) Vue file.
51
51
  - [Units](#units)
52
52
  - [AnimationGroup](#animationgroup)
53
53
  - [Presets](#presets)
54
+ - [Web Animations API](#web-animations-api)
55
+ - [Beyond CSS](#beyond-css)
56
+ - [NumericAnimation](#numericanimation)
57
+ - [SmoothProgress](#smoothprogress)
58
+ - [ElementMorph](#elementmorph)
59
+ - [Timeline](#timeline)
54
60
  - [Build & Development](#build--development)
55
61
 
56
62
  ## Installation
@@ -68,6 +74,10 @@ src/
68
74
  ├── animation/ # Animation engine: classes, group, presets, interpolation, WAAPI
69
75
  │ ├── index.ts # Animation, CSSKeyframesAnimation
70
76
  │ ├── group.ts # AnimationGroup — multi-animation compositor
77
+ │ ├── numeric.ts # NumericAnimation — keyframe interpolation over plain objects
78
+ │ ├── smooth.ts # SmoothProgress — exponential smoothing
79
+ │ ├── morph.ts # ElementMorph — position/scale interpolation between elements
80
+ │ ├── timeline.ts # Timeline, ScrollTimeline, ManualTimeline — progress drivers
71
81
  │ ├── animations.ts # 30+ preset animations
72
82
  │ ├── constants.ts # Types & defaults
73
83
  │ ├── utils.ts # Frame calc, value interpolation
@@ -96,7 +106,7 @@ demo/ # Vue 3 demo apps
96
106
  ├── boxes/ # Vanilla JS: matrix3d transforms
97
107
  └── bench/ # Performance benchmarks (rAF vs CSS vs WAAPI)
98
108
 
99
- test/ # Vitest (jsdom) — 11 suites
109
+ test/ # Vitest (jsdom) — 15 suites, 261 tests
100
110
  bench/ # Vitest benchmarks — 3 suites
101
111
  ```
102
112
 
@@ -287,6 +297,93 @@ anim.play();
287
297
 
288
298
  When `useWAAPI` is `true` (default), eligible animations run on the compositor thread via `Element.animate()`. Eligibility requires: DOM targets, uniform timing function across frames, no computed units, no custom transform function, no color interpolation. Falls back to `requestAnimationFrame` silently.
289
299
 
300
+ ## Beyond CSS
301
+
302
+ The library also ships general-purpose interpolation primitives, decoupled from CSS and the DOM. These compose into a pipeline: `timeline → progress → interpolator → values → apply`.
303
+
304
+ ### `NumericAnimation`
305
+
306
+ Keyframe interpolation over plain `{key: number}` objects. Zero-allocation hot path — returns the same object reference each call. Two usage modes: stateless `.at()` queries, or managed `.play()` with rAF-driven playback.
307
+
308
+ ```ts
309
+ // Stateless — drive from your own render loop
310
+ const anim = new NumericAnimation([
311
+ { x: 0, y: 0, opacity: 0 },
312
+ { x: 100, y: 200, opacity: 1 },
313
+ ]);
314
+ anim.at(0.5); // => { x: 50, y: 100, opacity: 0.5 }
315
+
316
+ // Managed — rAF playback with per-frame callback
317
+ const anim = new NumericAnimation(
318
+ [{ angle: 0 }, { angle: Math.PI * 4 }],
319
+ { duration: 2500, timingFunction: easeOutCubic },
320
+ );
321
+ await anim.play(({ angle }) => {
322
+ ctx.clearRect(0, 0, w, h);
323
+ drawDial(angle);
324
+ });
325
+ ```
326
+
327
+ Options: `duration` (ms, required for `.play()`), `timingFunction`, `positions` (explicit keyframe positions as percentages). Call `.stop()` to cancel a running playback — the play promise resolves immediately.
328
+
329
+ ### `SmoothProgress`
330
+
331
+ Exponential smoothing for progress values. Frame-rate independent via `tickDt(dt)`.
332
+
333
+ ```ts
334
+ const smooth = new SmoothProgress({ damping: 0.15 });
335
+ smooth.setTarget(1);
336
+ smooth.tick(); // asymptotically approaches 1
337
+ smooth.snap(); // instantly converge
338
+ ```
339
+
340
+ Options: `damping` (lerp factor, default 0.1), `snapThreshold` (auto-snap distance, default 0.001), `targetEpsilon` (ignore target changes smaller than this — filters scroll jitter, default 0), `initial`, `clamp`.
341
+
342
+ ### `ElementMorph`
343
+
344
+ Interpolates position and scale between two DOM elements (or rects). Produces CSS transforms. Stateless `.apply()` or managed `.play()`.
345
+
346
+ ```ts
347
+ // Stateless
348
+ const morph = new ElementMorph(sourceEl, targetEl);
349
+ morph.apply(element, progress); // writes transform + transformOrigin
350
+
351
+ // Managed playback
352
+ const morph = new ElementMorph(sourceEl, targetEl, {
353
+ duration: 400,
354
+ timingFunction: easeOutCubic,
355
+ });
356
+ await morph.play(element);
357
+ ```
358
+
359
+ Re-measures on demand via `morph.measure(from, to)`. Call `.stop()` to cancel.
360
+
361
+ ### `Timeline`
362
+
363
+ Abstract progress driver. Pipeline: `sample() → clamp → easing → boundary snap → smoothing`.
364
+
365
+ ```ts
366
+ const timeline = new ScrollTimeline({
367
+ threshold: 0.35,
368
+ easing: easeOutCubic,
369
+ boundaryEpsilon: 0.005,
370
+ smoothing: { damping: 0.15, targetEpsilon: 0.002 },
371
+ });
372
+
373
+ function update() {
374
+ const p = timeline.tick();
375
+ requestAnimationFrame(update);
376
+ }
377
+ ```
378
+
379
+ Options: `easing`, `smoothing` (`SmoothProgressOptions` or `false`), `boundaryEpsilon` (snap eased values within this distance of 0/1 to the boundary — prevents scroll-endpoint oscillation, default 0.005).
380
+
381
+ Subclasses:
382
+ - **`ScrollTimeline`** — scroll position → progress. `threshold` sets viewport fraction for full progress (default 0.35). Injectable `getScrollY`/`getViewportHeight`.
383
+ - **`ManualTimeline`** — externally set value → progress. Smoothing off by default.
384
+
385
+ See [`docs/scroll-morph.md`](docs/scroll-morph.md) for an architecture guide on building jitter-free scroll-driven morph animations.
386
+
290
387
  ## Build & Development
291
388
 
292
389
  ```sh
@@ -4,7 +4,13 @@ import { bounceInEaseHalf } from '@mkbabb/value.js';
4
4
  import { bounceInOutEase } from '@mkbabb/value.js';
5
5
  import { bounceOutEase } from '@mkbabb/value.js';
6
6
  import { bounceOutEaseHalf } from '@mkbabb/value.js';
7
+ import { cancelAnimationFrame as cancelAnimationFrame_2 } from '@mkbabb/value.js';
8
+ import { clamp } from '@mkbabb/value.js';
7
9
  import { CSSCubicBezier } from '@mkbabb/value.js';
10
+ import { cubicBezier } from '@mkbabb/value.js';
11
+ import { cubicBezierToString } from '@mkbabb/value.js';
12
+ import { cubicBezierToSVG } from '@mkbabb/value.js';
13
+ import { deCasteljau } from '@mkbabb/value.js';
8
14
  import { easeInBounce } from '@mkbabb/value.js';
9
15
  import { easeInCirc } from '@mkbabb/value.js';
10
16
  import { easeInCubic } from '@mkbabb/value.js';
@@ -22,9 +28,15 @@ import { easeOutExpo } from '@mkbabb/value.js';
22
28
  import { easeOutQuad } from '@mkbabb/value.js';
23
29
  import { easeOutSine } from '@mkbabb/value.js';
24
30
  import { HueInterpolationMethod } from '@mkbabb/value.js';
31
+ import { interpBezier } from '@mkbabb/value.js';
25
32
  import { InterpolatedVar } from '@mkbabb/value.js';
26
33
  import { jumpTerms } from '@mkbabb/value.js';
34
+ import { lerp } from '@mkbabb/value.js';
27
35
  import { linear } from '@mkbabb/value.js';
36
+ import { logerp } from '@mkbabb/value.js';
37
+ import { requestAnimationFrame as requestAnimationFrame_2 } from '@mkbabb/value.js';
38
+ import { scale } from '@mkbabb/value.js';
39
+ import { sleep } from '@mkbabb/value.js';
28
40
  import { smoothStep3 } from '@mkbabb/value.js';
29
41
  import { stepEnd } from '@mkbabb/value.js';
30
42
  import { steppedEase } from '@mkbabb/value.js';
@@ -58,12 +70,31 @@ declare class Animation_2<V extends Vars = any> {
58
70
  unflatten: boolean;
59
71
  private resolvePromise;
60
72
  private _playingPromise;
73
+ /**
74
+ * Pre-bound draw callback — allocated once to avoid creating a new
75
+ * closure on every requestAnimationFrame reschedule.
76
+ */
77
+ private _boundDraw;
61
78
  private dispatchAnimationEvent;
62
79
  constructor(options?: Partial<InputAnimationOptions>, targets?: HTMLElement[] | HTMLElement | undefined, name?: string | undefined, superKey?: string | undefined);
63
80
  convertFrameStart(frame: TemplateAnimationFrame<V>): TemplateAnimationFrame<V>;
64
81
  addFrame<K extends V>(start: number | string | ValueUnit<number>, vars: Partial<K>, transform?: TransformFunction<K>, timingFunction?: TimingFunction | TimingFunctionNames): Animation_2<K>;
65
82
  createFrame(startIx: number, endIx: number): AnimationFrame<V>;
66
- reconcileVars(ix: number): void;
83
+ /**
84
+ * Build an index mapping each variable name to the frame indices where
85
+ * it appears. Used by reconcileVars() for O(1) "next occurrence" lookups
86
+ * instead of O(N) findIndex scans per variable.
87
+ */
88
+ private buildVarIndex;
89
+ /**
90
+ * Reconcile interpolation variables across non-adjacent keyframes.
91
+ * For each variable at frame `ix`, find the next frame that also
92
+ * defines that variable and create an interpolation segment between them.
93
+ *
94
+ * Uses a pre-built variable index (from buildVarIndex) to avoid
95
+ * O(frames²) findIndex scans.
96
+ */
97
+ reconcileVars(ix: number, varIndex: Map<string, number[]>): void;
67
98
  parse(): this;
68
99
  setTimingFunction(timingFunction: InputAnimationOptions["timingFunction"]): this;
69
100
  setIterationCount(iterationCount: InputAnimationOptions["iterationCount"]): this;
@@ -83,6 +114,18 @@ declare class Animation_2<V extends Vars = any> {
83
114
  * regardless of playback direction. `apply=true` invokes transform callbacks.
84
115
  */
85
116
  at(progress: number, apply?: boolean): Record<string, ValueUnit[]>;
117
+ /**
118
+ * Interpolate all active frames at time `t`. This is the hot path —
119
+ * called once per rAF frame during playback.
120
+ *
121
+ * Uses binary search (O(log N)) to find the first matching frame,
122
+ * then scans neighbors to collect all overlapping frames at `t`
123
+ * (multiple properties may share the same time range).
124
+ *
125
+ * @param t - Current animation time in milliseconds
126
+ * @param transformFrames - If true, applies each frame's transform function to targets
127
+ * @returns Merged flat vars from all active frames
128
+ */
86
129
  interpFrames(t: number, transformFrames?: boolean): Record<string, ValueUnit<any, string | undefined>[]>;
87
130
  onStart(): Promise<void>;
88
131
  onEnd(): Promise<void>;
@@ -121,6 +164,12 @@ declare interface AnimationFrame<V extends Vars> {
121
164
  interpVars: {
122
165
  [arg: string]: Array<InterpolatedVar<V>>;
123
166
  };
167
+ /**
168
+ * Pre-flattened array of all interpolation variables across all properties.
169
+ * Built once during parse() to avoid Object.values().flat() allocation
170
+ * on every interpFrames() call in the hot path.
171
+ */
172
+ allInterpVars: Array<InterpolatedVar<V>>;
124
173
  transform: TransformFunction<V>;
125
174
  timingFunction: TimingFunction;
126
175
  }
@@ -136,15 +185,71 @@ export declare class AnimationGroup<V extends Vars> {
136
185
  lastTickTime: number;
137
186
  handleId: number | any;
138
187
  resolvePromise: ((value: void | PromiseLike<void>) => void) | null;
188
+ /**
189
+ * Pre-bound draw callback — allocated once in constructor to avoid
190
+ * creating a new closure on every requestAnimationFrame reschedule.
191
+ */
192
+ private _boundDraw;
193
+ /**
194
+ * Cached entries array, sorted by layer zIndex. Rebuilt on demand
195
+ * via dirty flag to avoid Object.values() allocation on every frame.
196
+ */
197
+ private _entries;
198
+ private _entriesDirty;
139
199
  constructor(...inputs: (Animation_2<V> | AnimationGroupInput<V>)[]);
200
+ /**
201
+ * Returns the animation entries sorted by layer zIndex.
202
+ * Uses dirty-flag caching — only rebuilds when the animations object
203
+ * or layer configs are mutated. All hot-path iteration (tick, draw,
204
+ * transformFramesGrouped) uses this instead of Object.values().
205
+ */
206
+ private getEntries;
207
+ /** Mark entries cache stale. Called at all mutation boundaries. */
208
+ private invalidateEntries;
140
209
  setSuperKey(superKey: string): this;
141
210
  setTargets(...targets: HTMLElement[]): this;
142
211
  onStart(): this;
143
212
  onEnd(): this;
213
+ /**
214
+ * Composite all animation values into a single grouped transform.
215
+ * Called per-frame for single-target groups. Applies layer blending
216
+ * (replace / add / weighted) in zIndex order, then calls the group
217
+ * transform function with the merged values.
218
+ */
144
219
  transformFramesGrouped(t: number): Record<string, unknown>;
220
+ /**
221
+ * Render the current animation state as a static frame.
222
+ * Called on pause to ensure the visual matches the exact pause moment.
223
+ * Handles both single-target (grouped blending) and multi-target
224
+ * (per-child interpFrames) paths.
225
+ */
226
+ private renderPauseFrame;
227
+ /**
228
+ * Advance all child animations to timestamp `t`.
229
+ * Awaits all child tick() promises so deferred state updates
230
+ * (startTime, this.t) resolve before interpFrames reads them.
231
+ */
145
232
  tick(t: number): Promise<this>;
233
+ /**
234
+ * Main animation frame callback. Ticks all children, then renders
235
+ * (single-target: grouped blending; multi-target: per-child).
236
+ * Reschedules itself via rAF until done.
237
+ */
146
238
  draw(t: number): Promise<void>;
239
+ /**
240
+ * Start the animation group. Returns a promise that resolves
241
+ * when all child animations complete (or on explicit stop/reset).
242
+ */
147
243
  play(): Promise<unknown>;
244
+ /**
245
+ * Toggle pause state. Calling pause() when playing pauses; calling
246
+ * pause() when paused resumes. (Toggle semantics preserved for
247
+ * backward compatibility with demo's toggleAnimationGroup.)
248
+ *
249
+ * On pause: explicitly cancels the rAF loop and renders a final
250
+ * frame snapshot so the visual matches the exact pause moment.
251
+ * On resume: re-registers the rAF loop.
252
+ */
148
253
  pause(): this;
149
254
  reset(): this;
150
255
  stop(): this;
@@ -214,6 +319,10 @@ export { bounceOutEase }
214
319
 
215
320
  export { bounceOutEaseHalf }
216
321
 
322
+ export { cancelAnimationFrame_2 as cancelAnimationFrame }
323
+
324
+ export { clamp }
325
+
217
326
  export { CSSCubicBezier }
218
327
 
219
328
  export declare class CSSKeyframesAnimation<V extends Vars> extends Animation_2<V> {
@@ -224,6 +333,14 @@ export declare class CSSKeyframesAnimation<V extends Vars> extends Animation_2<V
224
333
  transform(vars: V): void;
225
334
  }
226
335
 
336
+ export { cubicBezier }
337
+
338
+ export { cubicBezierToString }
339
+
340
+ export { cubicBezierToSVG }
341
+
342
+ export { deCasteljau }
343
+
227
344
  declare const DIRECTIONS: readonly ["normal", "reverse", "alternate", "alternate-reverse"];
228
345
 
229
346
  export { easeInBounce }
@@ -258,10 +375,19 @@ export { easeOutQuad }
258
375
 
259
376
  export { easeOutSine }
260
377
 
378
+ /**
379
+ * Interpolate position and scale between two elements or rects.
380
+ *
381
+ * Two usage modes:
382
+ * - **Stateless**: call `.at(progress)` or `.toCSSTransform(progress)`
383
+ * - **Managed**: call `.play(element)` to animate an element from source
384
+ * to destination over the configured duration
385
+ */
261
386
  export declare class ElementMorph {
262
387
  private animation;
263
388
  private transformOrigin;
264
389
  private timingFunction;
390
+ private duration;
265
391
  constructor(from: HTMLElement | MorphRect, to: HTMLElement | MorphRect, options?: ElementMorphOptions);
266
392
  /** Re-measure source and destination, rebuilding the internal animation. */
267
393
  measure(from: HTMLElement | MorphRect, to: HTMLElement | MorphRect): this;
@@ -271,10 +397,21 @@ export declare class ElementMorph {
271
397
  toCSSTransform(progress: number): string;
272
398
  /** Apply the morph transform to an element at the given progress [0, 1]. */
273
399
  apply(element: HTMLElement, progress: number): void;
400
+ /**
401
+ * Animate an element from source to destination over the configured duration.
402
+ *
403
+ * @param element — the element to apply transforms to
404
+ * @param duration — override the duration set in constructor options (ms)
405
+ */
406
+ play(element: HTMLElement, duration?: number): Promise<void>;
407
+ /** Cancel a running `.play()` animation. */
408
+ stop(): void;
274
409
  }
275
410
 
276
411
  export declare interface ElementMorphOptions {
277
412
  timingFunction?: TimingFunction | TimingFunctionNames;
413
+ /** Playback duration in milliseconds. Required for `.play()`. */
414
+ duration?: number;
278
415
  transformOrigin?: string;
279
416
  }
280
417
 
@@ -295,10 +432,16 @@ declare type InputAnimationOptions = Partial<{
295
432
  hueMethod?: HueInterpolationMethod;
296
433
  }>;
297
434
 
435
+ export { interpBezier }
436
+
298
437
  export { jumpTerms }
299
438
 
439
+ export { lerp }
440
+
300
441
  export { linear }
301
442
 
443
+ export { logerp }
444
+
302
445
  export declare class ManualTimeline extends Timeline {
303
446
  private value;
304
447
  constructor(options?: TimelineOptions);
@@ -322,29 +465,74 @@ declare interface MorphValues {
322
465
  scaleY: number;
323
466
  }
324
467
 
468
+ /**
469
+ * Zero-allocation numeric keyframe interpolator.
470
+ *
471
+ * Interpolates plain `Record<string, number>` keyframes using O(log N)
472
+ * binary-search segment lookup. Designed for canvas/WebGL render loops
473
+ * where CSS value parsing and DOM targets are unnecessary overhead.
474
+ *
475
+ * Two usage modes:
476
+ * - **Stateless**: call `.at(progress)` from your own render loop
477
+ * - **Managed**: call `.play(onFrame?)` to run a rAF-driven playback
478
+ * that resolves when the animation completes
479
+ */
325
480
  export declare class NumericAnimation<T extends Record<string, number>> {
326
481
  private keyframes;
327
482
  private segments;
328
483
  private positions;
329
484
  private timingFn;
330
485
  private result;
486
+ private _duration;
487
+ private _rafId;
488
+ private _resolve;
489
+ private _startTime;
331
490
  constructor(keyframes: T[], options?: NumericAnimationOptions);
332
491
  private buildSegments;
333
492
  private buildSegment;
334
- /** Map [0, 1] progress to interpolated values. Zero allocation. */
493
+ /**
494
+ * Map [0, 1] progress to interpolated values. Zero allocation —
495
+ * returns the same pre-allocated result object on every call.
496
+ *
497
+ * Uses O(log N) binary search over segments. Falls back to the
498
+ * last segment if progress is past the final stop position.
499
+ */
335
500
  at(progress: number): T;
336
501
  /** Update a keyframe's values in-place, recomputing adjacent segments. */
337
502
  updateKeyframe(index: number, values: Partial<T>): this;
503
+ /**
504
+ * Play the animation over its duration using requestAnimationFrame.
505
+ *
506
+ * Calls `onFrame` each frame with the interpolated values (the same
507
+ * zero-allocation object returned by `.at()`). Returns a Promise that
508
+ * resolves when the animation completes or is stopped.
509
+ *
510
+ * @param onFrame — optional per-frame callback receiving interpolated values
511
+ * @param duration — override the duration set in constructor options (ms)
512
+ */
513
+ play(onFrame?: NumericFrameCallback<T>, duration?: number): Promise<void>;
514
+ /** Cancel a running `.play()` animation. The play promise resolves immediately. */
515
+ stop(): void;
516
+ private _cleanup;
338
517
  }
339
518
 
340
519
  export declare interface NumericAnimationOptions {
341
520
  timingFunction?: TimingFunction | TimingFunctionNames | undefined;
521
+ /** Playback duration in milliseconds. Required for `.play()`. */
522
+ duration?: number | undefined;
342
523
  /** Explicit positions as percentages [0-100]. Auto-distributes if omitted. */
343
524
  positions?: number[] | undefined;
344
525
  }
345
526
 
527
+ /** Callback invoked each frame during `.play()` with the interpolated values. */
528
+ export declare type NumericFrameCallback<T extends Record<string, number>> = (values: T) => void;
529
+
346
530
  declare type ParsedVarMap = Record<string, ValueArray>;
347
531
 
532
+ export { requestAnimationFrame_2 as requestAnimationFrame }
533
+
534
+ export { scale }
535
+
348
536
  export declare class ScrollTimeline extends Timeline {
349
537
  private threshold;
350
538
  private getScrollY;
@@ -362,6 +550,8 @@ export declare interface ScrollTimelineOptions extends TimelineOptions {
362
550
  getViewportHeight?: (() => number) | undefined;
363
551
  }
364
552
 
553
+ export { sleep }
554
+
365
555
  export declare class SmoothProgress {
366
556
  private options;
367
557
  private targetValue;
@@ -387,6 +577,12 @@ export declare interface SmoothProgressOptions {
387
577
  damping: number;
388
578
  /** Snap to target when |target - current| < threshold. Default 0.001 */
389
579
  snapThreshold: number;
580
+ /**
581
+ * Minimum change required to update the target. Changes smaller than this
582
+ * are ignored, filtering high-frequency noise (e.g. sub-pixel scroll jitter).
583
+ * Default 0 (disabled — every change is accepted).
584
+ */
585
+ targetEpsilon: number;
390
586
  /** Starting value. Default 0 */
391
587
  initial: number;
392
588
  /** Clamp current to [0, 1]. Default true */
@@ -413,12 +609,25 @@ export declare abstract class Timeline {
413
609
  private smoother;
414
610
  private easingFn;
415
611
  private currentProgress;
612
+ private boundaryEpsilon;
416
613
  constructor(options?: TimelineOptions);
417
614
  /** Subclass returns raw [0,1] progress from its source. */
418
615
  protected abstract sample(): number;
419
- /** Advance one frame. Applies easing -> boundary snap -> smoothing. */
616
+ /**
617
+ * Shared progress pipeline: sample → clamp → easing → boundary snap.
618
+ * Returns the processed raw value. Does NOT advance the smoother —
619
+ * the caller (tick or tickDt) drives the smoother with the appropriate
620
+ * time-step method.
621
+ */
622
+ private applyPipeline;
623
+ /**
624
+ * Finalize progress after the smoother has been advanced (or bypassed).
625
+ * Snaps the smoother at boundaries [0, 1] for instant convergence.
626
+ */
627
+ private finalizeProgress;
628
+ /** Advance one frame. Applies easing → boundary snap → smoothing. */
420
629
  tick(): number;
421
- /** Frame-rate independent variant. dt in ms. */
630
+ /** Frame-rate independent variant. `dt` in milliseconds. */
422
631
  tickDt(dt: number): number;
423
632
  get progress(): number;
424
633
  /** True if no smoother or smoother is settled. */
@@ -433,6 +642,14 @@ export declare interface TimelineOptions {
433
642
  easing?: TimingFunction | TimingFunctionNames | undefined;
434
643
  /** SmoothProgress config. `false` disables smoothing. Default: enabled. */
435
644
  smoothing?: Partial<SmoothProgressOptions> | false | undefined;
645
+ /**
646
+ * Boundary snap zone. When the eased progress is within this distance of
647
+ * 0 or 1, the smoother snaps instantly instead of lerping. Prevents
648
+ * oscillation at scroll endpoints where micro-jitter alternates between
649
+ * boundary and non-boundary values each frame.
650
+ * Default 0.005.
651
+ */
652
+ boundaryEpsilon?: number | undefined;
436
653
  }
437
654
 
438
655
  declare type TimingFunction = (t: number) => number;