@weasel-js/animator 1.10.0 → 1.10.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
@@ -4,7 +4,7 @@ Tweens, springs, holds, staggers, and timelines on one frame loop, with no scene
4
4
 
5
5
  Part of [weasel](https://github.com/orochi235/weasel), a domain-agnostic 2D
6
6
  scene-graph canvas kit for React. See the
7
- [API reference](https://orochi235.github.io/weasel/api/).
7
+ [API reference](https://orochi235.github.io/weasel/#pkg/animator).
8
8
 
9
9
  ```sh
10
10
  npm install @weasel-js/animator
package/dist/index.d.ts CHANGED
@@ -1122,11 +1122,11 @@ declare function solidVertexColors(n: number, r: number, g: number, b: number, a
1122
1122
  */
1123
1123
  declare function sampleTrack<T>(track: SampledTrack<T>, t: number, segmentCache?: Map<number, (u: number) => T>): T | undefined;
1124
1124
 
1125
- /** A value a clip can hold: what `JSON.stringify` writes and `JSON.parse` reads back. An
1126
- * object's `undefined` members are left out, as JSON leaves them. */
1127
- type ClipValue = number | string | boolean | null | ClipValue[] | {
1128
- [key: string]: ClipValue | undefined;
1129
- };
1125
+ /** A value a clip can hold: what `JSON.stringify` writes and `JSON.parse` reads back. The
1126
+ * object arm is any object, so a pose typed by an interface is one; `toClip` is what refuses
1127
+ * a member JSON cannot round-trip. An object's `undefined` members are left out, as JSON
1128
+ * leaves them. */
1129
+ type ClipValue = number | string | boolean | null | ClipValue[] | object;
1130
1130
  /** A keyframe as data. Its easing is a built-in's name or bezier control points. */
1131
1131
  interface ClipKey {
1132
1132
  t: number;
package/dist/index.js CHANGED
@@ -1369,11 +1369,8 @@ function tracksEnd(tracks, explicit) {
1369
1369
  }
1370
1370
  function crossLaps(playhead, duration, loopsLeft, take) {
1371
1371
  if (duration <= 0 || playhead < duration) return;
1372
- if (loopsLeft === Infinity) {
1373
- take(Math.floor(playhead / duration));
1374
- return;
1375
- }
1376
- for (let at = playhead, left = loopsLeft; at >= duration && left > 0; at -= duration, left -= 1) take(1);
1372
+ const laps = Math.min(Math.floor(playhead / duration), loopsLeft);
1373
+ if (laps > 0) take(laps);
1377
1374
  }
1378
1375
  function createTimeline(register, id, opts, report, hold) {
1379
1376
  let duration = tracksEnd(opts.tracks, opts.duration);