@ignifx/2d 0.15.0 → 0.16.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/dist/index.d.ts CHANGED
@@ -154,8 +154,18 @@ interface SpriteFrameDefinition {
154
154
  * bottom-right. Defaults to the centre. Written either as `[x, y]` or as `{ x, y }`.
155
155
  */
156
156
  readonly pivot?: Vec2Json;
157
- /** The untrimmed source size, when the packer trimmed transparent margins. Defaults to `w`/`h`. */
157
+ /**
158
+ * The untrimmed source size, when the packer trimmed transparent margins. Defaults to `w`/`h`.
159
+ * With `sourceOffset`, the pivot is in `[0, 1]` of this size and the frame draws at `w`/`h`;
160
+ * without it, the frame draws stretched to this size, as before `sourceOffset` existed.
161
+ */
158
162
  readonly sourceSize?: Vec2Json;
163
+ /**
164
+ * Where the trimmed rectangle's top-left corner sits inside the untrimmed source, in pixels from
165
+ * the source's top-left: TexturePacker's and Aseprite's `spriteSourceSize.x`/`.y`. Needs
166
+ * `sourceSize`. Absent means the frame is not placed as trimmed.
167
+ */
168
+ readonly sourceOffset?: Vec2Json;
159
169
  }
160
170
  /**
161
171
  * The parsed `.atlas.json` document.
@@ -375,6 +385,21 @@ interface SpriteAtlasAssetLiteHandles {
375
385
  /** The Lite atlas, or `null` under a headless app, which uploads nothing. */
376
386
  readonly atlas: LiteSpriteAtlas | null;
377
387
  }
388
+ /**
389
+ * Where a trimmed frame sits inside the image it was cut from, before the packer trimmed it.
390
+ *
391
+ * @public
392
+ */
393
+ interface SpriteFrameTrim {
394
+ /** The trimmed rectangle's left edge inside the untrimmed source, in pixels. */
395
+ readonly offsetXPx: number;
396
+ /** The trimmed rectangle's top edge inside the untrimmed source, in pixels. */
397
+ readonly offsetYPx: number;
398
+ /** The untrimmed source width, in pixels. */
399
+ readonly sourceWidthPx: number;
400
+ /** The untrimmed source height, in pixels. */
401
+ readonly sourceHeightPx: number;
402
+ }
378
403
  /**
379
404
  * One frame of a loaded atlas, as game code sees it.
380
405
  *
@@ -385,12 +410,17 @@ interface SpriteFrameInfo {
385
410
  readonly name: string;
386
411
  /** Its index in the atlas, which is what Lite addresses frames by. */
387
412
  readonly index: number;
388
- /** Its drawn width, in image pixels. */
413
+ /** Its drawn width, in image pixels: the trimmed width when `trim` is set. */
389
414
  readonly widthPx: number;
390
- /** Its drawn height, in image pixels. */
415
+ /** Its drawn height, in image pixels: the trimmed height when `trim` is set. */
391
416
  readonly heightPx: number;
392
- /** Its pivot in `[0, 1]` of the frame, `[0, 0]` top-left. */
417
+ /** Its pivot in `[0, 1]` of the frame, `[0, 0]` top-left; of the untrimmed source when `trim` is set. */
393
418
  readonly pivot: Vec2Like;
419
+ /**
420
+ * Where the trimmed frame sits in its untrimmed source, from the document's `sourceOffset` and
421
+ * `sourceSize`; `null` for a frame the document does not place as trimmed.
422
+ */
423
+ readonly trim: SpriteFrameTrim | null;
394
424
  }
395
425
  /**
396
426
  * A loaded sprite atlas.
@@ -1970,6 +2000,48 @@ export declare class TwoDAnimationSystem implements System {
1970
2000
  update(ctx: SystemContext): void;
1971
2001
  }
1972
2002
  //#endregion
2003
+ //#region src/animation/clip-time.d.ts
2004
+ /**
2005
+ * Which frame of a sprite clip shows at a given time: the same rule `SpriteAnimator` plays by, as a
2006
+ * pure function, so an editor can scrub a clip by time (engine ask E51) and a test can check the
2007
+ * mapping without an app.
2008
+ */
2009
+ /**
2010
+ * The parts of a clip {@link spriteClipFrameAtTime} reads.
2011
+ *
2012
+ * @public
2013
+ */
2014
+ interface SpriteClipTiming {
2015
+ /** How many frames the clip has. */
2016
+ readonly frameCount: number;
2017
+ /** Frames per second. */
2018
+ readonly fps: number;
2019
+ /** Whether the clip restarts at its end. */
2020
+ readonly loop: boolean;
2021
+ }
2022
+ /**
2023
+ * The frame within a clip that shows `seconds` into it, counting from `0`.
2024
+ *
2025
+ * @remarks
2026
+ * Frame `n` shows from `n / (fps × speed)` seconds until the next one starts, as in playback. Past
2027
+ * the end a looping clip wraps and a one-shot clip holds its last frame; before `0` a looping clip
2028
+ * wraps backwards and a one-shot clip holds its first. A clip with no frames, or a rate of `0` or
2029
+ * less, answers `0`.
2030
+ *
2031
+ * @param clip - The clip's frame count, frame rate and loop flag.
2032
+ * @param seconds - How far into the clip, in seconds.
2033
+ * @param speed - A multiplier on the clip's frame rate, as `SpriteAnimator.speed`. Defaults to `1`.
2034
+ * @returns The frame index within the clip, in `[0, frameCount - 1]`.
2035
+ *
2036
+ * @example
2037
+ * ```ts
2038
+ * spriteClipFrameAtTime({ frameCount: 4, fps: 8, loop: true }, 0.6); // 0 (wrapped from frame 4)
2039
+ * ```
2040
+ *
2041
+ * @public
2042
+ */
2043
+ export declare function spriteClipFrameAtTime(clip: SpriteClipTiming, seconds: number, speed?: number): number;
2044
+ //#endregion
1973
2045
  //#region src/animation/definition.d.ts
1974
2046
  /**
1975
2047
  * The `ignifx.spriteanimation` document — the `.spriteanim.json` file that names an atlas and the
@@ -2457,6 +2529,23 @@ export declare class SpriteAnimator extends Component implements ComponentHooks
2457
2529
  * ```
2458
2530
  */
2459
2531
  sample(name: string, frameIndex: number): boolean;
2532
+ /**
2533
+ * Shows the frame of a clip that plays `seconds` into it, without playing it: {@link
2534
+ * SpriteAnimator.sample} at the frame `spriteClipFrameAtTime` picks, at this animator's `speed`.
2535
+ * A looping clip wraps and a one-shot clip holds its first or last frame.
2536
+ *
2537
+ * @param name - The clip's name.
2538
+ * @param seconds - How far into the clip, in seconds.
2539
+ * @returns `true` when the frame was written; `false` while the document or the atlas is still
2540
+ * loading, or when the clip has no frames.
2541
+ * @throws IgnifxError with code `IGX-1108` when the document declares no such clip.
2542
+ *
2543
+ * @example
2544
+ * ```ts
2545
+ * animator.sampleTime("run", 0.25);
2546
+ * ```
2547
+ */
2548
+ sampleTime(name: string, seconds: number): boolean;
2460
2549
  /**
2461
2550
  * Advances playback by one frame's worth of scaled time. The animation system calls this in
2462
2551
  * `PostUpdate`.
@@ -2631,17 +2720,14 @@ interface TexturePackerImportOptions {
2631
2720
  *
2632
2721
  * A frame's `pivot` is used as-is when the document declares one: TexturePacker already writes
2633
2722
  * pivots normalised into `[0, 1]` against a top-left origin, which is exactly ignifx's convention.
2634
- * Frames without one get the centre. A frame marked `trimmed` carries its `sourceSize` through so
2635
- * the loader can lay the trimmed rectangle back inside its original bounds.
2723
+ * Frames without one get the centre. A frame marked `trimmed` carries its `sourceSize` and, from
2724
+ * `spriteSourceSize.x`/`.y`, its `sourceOffset` through, so the trimmed pixels draw where the
2725
+ * untrimmed frame would have put them.
2636
2726
  *
2637
2727
  * @remarks
2638
2728
  * Rotated frames are rejected rather than silently drawn wrong — the sprite pipeline has no
2639
2729
  * per-frame rotation flag.
2640
2730
  *
2641
- * `spriteSourceSize`'s **offset** (`x`/`y`) has no home in `SpriteFrameDefinition`, which records
2642
- * only the untrimmed size, so a trimmed frame whose art is not centred in its source bounds may sit
2643
- * slightly off. Pack with trimming disabled, or with `spriteSourceSize` centred, when that matters.
2644
- *
2645
2731
  * @param json - The parsed TexturePacker document.
2646
2732
  * @param options - The image override, name handling, and sampling.
2647
2733
  * @returns The complete atlas document.
@@ -2680,8 +2766,8 @@ interface AsepriteImportOptions {
2680
2766
  * is put through {@link asepriteFrameName}; `importAsepriteAnimations` uses the same normaliser,
2681
2767
  * which is what makes the imported clips and the imported atlas agree on names.
2682
2768
  *
2683
- * A trimmed frame keeps its `sourceSize` so the loader can place the trimmed rectangle back inside
2684
- * its original bounds.
2769
+ * A trimmed frame keeps its `sourceSize` and its `sourceOffset` (from `spriteSourceSize.x`/`.y`), so
2770
+ * the trimmed pixels draw where the untrimmed frame would have put them.
2685
2771
  *
2686
2772
  * @remarks
2687
2773
  * Pivots are **best-effort**. Aseprite has no per-frame pivot; it has slices, which carry an
@@ -4510,5 +4596,5 @@ export declare class TilemapRenderer extends Component implements ComponentHooks
4510
4596
  */
4511
4597
  export declare const VERSION: string;
4512
4598
  //#endregion
4513
- export type { AnimatedTilemapSink, AsepriteAnimationImportOptions, AsepriteImportOptions, CollisionMergeOptions, GridAtlasImportOptions, LdtkImportOptions, LiteAtlasTexture, LiteBounds2D, LiteSprite2DHandle, LiteSprite2DLayer, LiteSprite2DView, LiteSpriteAtlas, LiteSpriteBlendMode, LiteSpriteFrame, LiteSpritePickInfo, LiteSpriteRenderer, LiteSpriteSampling, PlayClipOptions, SpriteAnimationDefinition, SpriteAnimationEvent, SpriteAnimationInput, SpriteAsset, SpriteAtlasAssetLiteHandles, SpriteAtlasDefinition, SpriteAtlasInput, SpriteBatch, SpriteBatchLiteHandles, SpriteBatchOptions, SpriteBlendName, SpriteClip, SpriteClipDefinition, SpriteEffectKind, SpriteFrameDefinition, SpriteFrameInfo, SpriteLayerEntry, SpriteLayerKey, TexturePackerImportOptions, TileAnimationFrame, TileChange, TileColliderDefinition, TileCollisionInfo, TileCollisionShape, TileDefinition, TileRleData, TileWrite, TiledImportOptions, TilemapCollisionChunk, TilemapCollisionData, TilemapDefinition, TilemapInput, TilemapLayerDefinition, TilemapLayerInput, TilemapObjectDefinition, TilesetDefinition, TwoDErrorOptions, TwoDLiteHandles, TwoDMode, TwoDOptions, TwoDPick, TwoDPickAllOptions, TwoDPickOptions, TwoDSettings, Vec2Json, WorldBox };
4599
+ export type { AnimatedTilemapSink, AsepriteAnimationImportOptions, AsepriteImportOptions, CollisionMergeOptions, GridAtlasImportOptions, LdtkImportOptions, LiteAtlasTexture, LiteBounds2D, LiteSprite2DHandle, LiteSprite2DLayer, LiteSprite2DView, LiteSpriteAtlas, LiteSpriteBlendMode, LiteSpriteFrame, LiteSpritePickInfo, LiteSpriteRenderer, LiteSpriteSampling, PlayClipOptions, SpriteAnimationDefinition, SpriteAnimationEvent, SpriteAnimationInput, SpriteAsset, SpriteAtlasAssetLiteHandles, SpriteAtlasDefinition, SpriteAtlasInput, SpriteBatch, SpriteBatchLiteHandles, SpriteBatchOptions, SpriteBlendName, SpriteClip, SpriteClipDefinition, SpriteClipTiming, SpriteEffectKind, SpriteFrameDefinition, SpriteFrameInfo, SpriteFrameTrim, SpriteLayerEntry, SpriteLayerKey, TexturePackerImportOptions, TileAnimationFrame, TileChange, TileColliderDefinition, TileCollisionInfo, TileCollisionShape, TileDefinition, TileRleData, TileWrite, TiledImportOptions, TilemapCollisionChunk, TilemapCollisionData, TilemapDefinition, TilemapInput, TilemapLayerDefinition, TilemapLayerInput, TilemapObjectDefinition, TilesetDefinition, TwoDErrorOptions, TwoDLiteHandles, TwoDMode, TwoDOptions, TwoDPick, TwoDPickAllOptions, TwoDPickOptions, TwoDSettings, Vec2Json, WorldBox };
4514
4600
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/service/sorting-layers.ts","../src/atlas/definition.ts","../src/lite/types.ts","../src/atlas/sprite-atlas-asset.ts","../src/lite/sprite-layer.ts","../src/sprite/sprite-renderer.ts","../src/service/layer-registry.ts","../src/camera/camera-2d.ts","../src/sprite/parallax-layer.ts","../src/settings.ts","../src/service/runtime.ts","../src/service/sprite-batch.ts","../src/service/two-d-service.ts","../src/augmentation.ts","../src/tilemap/animated-tiles.ts","../src/animation/animation-system.ts","../src/animation/definition.ts","../src/animation/importers.ts","../src/animation/sprite-animation-asset.ts","../src/animation/loader.ts","../src/animation/sprite-animator.ts","../src/assets/relative.ts","../src/atlas/importers.ts","../src/atlas/loader.ts","../src/camera/camera-2d-follow.ts","../src/errors.ts","../src/extension.ts","../src/file-schemas.ts","../src/math/coords.ts","../src/schemas.ts","../src/service/sync-system.ts","../src/sprite/sprite-layer-effect.ts","../src/tilemap/collision-data.ts","../src/tilemap/collision-merge.ts","../src/tilemap/definition.ts","../src/tilemap/importers/ldtk.ts","../src/tilemap/importers/tiled.ts","../src/tilemap/tilemap-asset.ts","../src/tilemap/tilemap.ts","../src/tilemap/tilemap-renderer.ts","../src/version.ts"],"mappings":";;;;;;;;;;;;;;;;;qBAiBa;;;;;;;;;;;qBAYA;;;;;;;;;;;;qBAaA;;;;;;;EAUX,YAAY;;;;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Q;;EAGf,KAAa,YAAY;;EAGzB;;EAGA;;;;EAoCA;;;;EAQA;;;;EAWA;;;;;;MAUI,iBAAiB,OAAO;;;;;;;;;;;;MAexB,sBAAsB;;;;;;MAStB,SAAS;;;;;;MAUT,cAAc;;;;;;MASd;;;;;;MAYA;;;;;;;;;;;MAcA,iBAAiB;;;;;;;;;EAiBrB,QAAQ,eAAe,WAAW;;;;;;;;;;EAoBlC,QAAQ,eAAe,WAAW,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4C7C,SAAS,gBAAgB;;;;;;;;;;;EAmDzB,WAAW,gBAAgB;;;;;;;EAe3B,UAAU,gBAAgB;;;;;;;;;;;;;EAiB1B,YAAY,aAAa,aAAa,OAAO,UAAU,KAAK,OAAO;;;;;;;;;EAuBnE,YAAY,aAAa,aAAa,WAAW,WAAW,KAAK,OAAO;;;;;;;;EAexE,YAAY,WAAW,YAAY;;;;;;EAuBnC;;;;;;;;;;;;;;;;;qBCxZW,wBAAwB,qBAAqB;;;SAEjD;;SAGA;;SAGA;;SAGA,QAAQ;;EAGf,OAAe,YAAY;;EAG3B;;EAGA;;;;EAoBA;;;;EAQA;;;;EAOA;;;;;;MASI;;;;;;MASA;;;;;;MAaA,eAAe;;;;;;;;;;;EAenB;;;;;;;;;;;;EAeA,KAAK,KAAK,SAAS,UAAU,qBAAqB,QAAQ,qBAAqB;;;;;;;;;EA6C/E,iBAAiB;;;;;;;;MAmBb;;;;;;;;EAWJ,QAAQ,UAAU;;;;;;;;;;;;;;qBC7NP"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/service/sorting-layers.ts","../src/atlas/definition.ts","../src/lite/types.ts","../src/atlas/sprite-atlas-asset.ts","../src/lite/sprite-layer.ts","../src/sprite/sprite-renderer.ts","../src/service/layer-registry.ts","../src/camera/camera-2d.ts","../src/sprite/parallax-layer.ts","../src/settings.ts","../src/service/runtime.ts","../src/service/sprite-batch.ts","../src/service/two-d-service.ts","../src/augmentation.ts","../src/tilemap/animated-tiles.ts","../src/animation/animation-system.ts","../src/animation/clip-time.ts","../src/animation/definition.ts","../src/animation/importers.ts","../src/animation/sprite-animation-asset.ts","../src/animation/loader.ts","../src/animation/sprite-animator.ts","../src/assets/relative.ts","../src/atlas/importers.ts","../src/atlas/loader.ts","../src/camera/camera-2d-follow.ts","../src/errors.ts","../src/extension.ts","../src/file-schemas.ts","../src/math/coords.ts","../src/schemas.ts","../src/service/sync-system.ts","../src/sprite/sprite-layer-effect.ts","../src/tilemap/collision-data.ts","../src/tilemap/collision-merge.ts","../src/tilemap/definition.ts","../src/tilemap/importers/ldtk.ts","../src/tilemap/importers/tiled.ts","../src/tilemap/tilemap-asset.ts","../src/tilemap/tilemap.ts","../src/tilemap/tilemap-renderer.ts","../src/version.ts"],"mappings":";;;;;;;;;;;;;;;;;qBAiBa;;;;;;;;;;;qBAYA;;;;;;;;;;;;qBAaA;;;;;;;EAUX,YAAY;;;;;;MAuBR;;;;;;;EAUJ,QAAQ;;;;;;;;EAWR,QAAQ;;;;;;;;EAkBR,QAAQ;;;;;;;;;;;;;;;;;qBCjGG;;;;;;qBAOA;;;;;;qBAOA;;;;;;qBAOA;;;;;;qBAOA;;;;;;;KAQD,WAAW;;;;;;;;;;wBAWP,SAAS,OAAO,sBAAsB,UAAU,WAAW;;;;;;UAyB1D;;WAEN;;WAEA;;WAEA;;WAEA;;WAEA;;;;;WAKA,QAAQ;;;;;;WAMR,aAAa;;;;;;WAMb,eAAe;;;;;;;;;;;;;;;;UAiBT;;WAEN,eAAe;;WAEf;;WAEA;;WAEA;;WAEA;;WAEA,iBAAiB;;;;;;;UAQX;;WAEN;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA,iBAAiB;;;;;;;;;;;;;wBAcZ,kBAAkB,OAAO,kBAAkB,mBAAuB;;;;;;;;;;;;;;wBA+GlE,oBAAoB;;;;;;;;;;;;;;;;;;;;KCjQxB,qBAAqB;;;;;;;;;;KAWrB,oBAAoB;;;;;;;;;;KAWpB,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;EAiB1B,YAAY,aAAa,aAAa,OAAO,UAAU,KAAK,OAAO;;;;;;;;;EAuBnE,YAAY,aAAa,aAAa,WAAW,WAAW,KAAK,OAAO;;;;;;;;EAexE,YAAY,WAAW,YAAY;;;;;;EAuBnC;;;;;;;;;;;;;;;;;qBCxZW,wBAAwB,qBAAqB;;;SAEjD;;SAGA;;SAGA;;SAGA,QAAQ;;EAGf,OAAe,YAAY;;EAG3B;;EAGA;;;;EAoBA;;;;EAQA;;;;EAOA;;;;;;MASI;;;;;;MASA;;;;;;MAaA,eAAe;;;;;;;;;;;EAenB;;;;;;;;;;;;EAeA,KAAK,KAAK,SAAS,UAAU,qBAAqB,QAAQ,qBAAqB;;;;;;;;;EA6C/E,iBAAiB;;;;;;;;MAmBb;;;;;;;;EAWJ,QAAQ,UAAU;;;;;;;;;;;;;;qBC7NP"}
package/dist/index.js CHANGED
@@ -227,6 +227,7 @@ function defineSpriteAtlas(input, address = "<inline>") {
227
227
  seen.add(frame.name);
228
228
  if (!(frame.w > 0) || !(frame.h > 0)) fail(`frame ${frame.name} has a non-positive size`);
229
229
  if (!(frame.x >= 0) || !(frame.y >= 0)) fail(`frame ${frame.name} starts outside the image`);
230
+ if (frame.sourceOffset !== void 0) checkSourceOffset(frame, fail);
230
231
  }
231
232
  const frames = [];
232
233
  for (let index = 0; index < input.frames.length; index += 1) {
@@ -238,7 +239,8 @@ function defineSpriteAtlas(input, address = "<inline>") {
238
239
  ...frame.sourceSize === void 0 ? {} : { sourceSize: readVec2(frame.sourceSize, {
239
240
  x: frame.w,
240
241
  y: frame.h
241
- }) }
242
+ }) },
243
+ ...frame.sourceOffset === void 0 ? {} : { sourceOffset: readVec2(frame.sourceOffset, UNREADABLE) }
242
244
  });
243
245
  }
244
246
  return {
@@ -257,6 +259,26 @@ const CENTRE_PIVOT$3 = Object.freeze({
257
259
  x: .5,
258
260
  y: .5
259
261
  });
262
+ /** What a malformed 2D value reads as, so the range check below refuses it. */
263
+ const UNREADABLE = Object.freeze({
264
+ x: NaN,
265
+ y: NaN
266
+ });
267
+ /**
268
+ * Checks that a frame's `sourceOffset` places its trimmed rectangle inside its `sourceSize`.
269
+ *
270
+ * @param frame - A frame that declares `sourceOffset`.
271
+ * @param fail - Throws the document's `IGX-1103`.
272
+ */
273
+ function checkSourceOffset(frame, fail) {
274
+ if (frame.sourceSize === void 0) {
275
+ fail(`frame ${frame.name} has a sourceOffset but no sourceSize`);
276
+ return;
277
+ }
278
+ const offset = readVec2(frame.sourceOffset, UNREADABLE);
279
+ const source = readVec2(frame.sourceSize, UNREADABLE);
280
+ if (!(offset.x >= 0) || !(offset.y >= 0) || !(offset.x + frame.w <= source.x) || !(offset.y + frame.h <= source.y)) fail(`frame ${frame.name}'s sourceOffset does not place its rectangle inside its sourceSize`);
281
+ }
260
282
  /**
261
283
  * Splits a sprite address into its atlas address and its frame name.
262
284
  *
@@ -397,12 +419,31 @@ var SpriteAtlasAsset = class {
397
419
  x: declared.w,
398
420
  y: declared.h
399
421
  });
400
- return {
422
+ if (declared.sourceOffset === void 0) return {
401
423
  name: declared.name,
402
424
  index,
403
425
  widthPx: source.x,
404
426
  heightPx: source.y,
405
- pivot
427
+ pivot,
428
+ trim: null
429
+ };
430
+ const offset = readVec2(declared.sourceOffset, {
431
+ x: 0,
432
+ y: 0
433
+ });
434
+ const trim = {
435
+ offsetXPx: offset.x,
436
+ offsetYPx: offset.y,
437
+ sourceWidthPx: source.x,
438
+ sourceHeightPx: source.y
439
+ };
440
+ return {
441
+ name: declared.name,
442
+ index,
443
+ widthPx: declared.w,
444
+ heightPx: declared.h,
445
+ pivot,
446
+ trim
406
447
  };
407
448
  }
408
449
  /**
@@ -1342,6 +1383,37 @@ function spriteRendererSchema() {
1342
1383
  });
1343
1384
  }
1344
1385
  //#endregion
1386
+ //#region src/animation/clip-time.ts
1387
+ /**
1388
+ * The frame within a clip that shows `seconds` into it, counting from `0`.
1389
+ *
1390
+ * @remarks
1391
+ * Frame `n` shows from `n / (fps × speed)` seconds until the next one starts, as in playback. Past
1392
+ * the end a looping clip wraps and a one-shot clip holds its last frame; before `0` a looping clip
1393
+ * wraps backwards and a one-shot clip holds its first. A clip with no frames, or a rate of `0` or
1394
+ * less, answers `0`.
1395
+ *
1396
+ * @param clip - The clip's frame count, frame rate and loop flag.
1397
+ * @param seconds - How far into the clip, in seconds.
1398
+ * @param speed - A multiplier on the clip's frame rate, as `SpriteAnimator.speed`. Defaults to `1`.
1399
+ * @returns The frame index within the clip, in `[0, frameCount - 1]`.
1400
+ *
1401
+ * @example
1402
+ * ```ts
1403
+ * spriteClipFrameAtTime({ frameCount: 4, fps: 8, loop: true }, 0.6); // 0 (wrapped from frame 4)
1404
+ * ```
1405
+ *
1406
+ * @public
1407
+ */
1408
+ function spriteClipFrameAtTime(clip, seconds, speed = 1) {
1409
+ const count = Math.trunc(clip.frameCount);
1410
+ const rate = clip.fps * speed;
1411
+ if (count <= 0 || !(rate > 0) || !Number.isFinite(seconds)) return 0;
1412
+ const raw = Math.floor(seconds * rate);
1413
+ if (clip.loop) return Number.isFinite(raw) ? (raw % count + count) % count : 0;
1414
+ return Math.min(Math.max(raw, 0), count - 1);
1415
+ }
1416
+ //#endregion
1345
1417
  //#region src/animation/definition.ts
1346
1418
  /**
1347
1419
  * The `ignifx.spriteanimation` document — the `.spriteanim.json` file that names an atlas and the
@@ -1795,6 +1867,34 @@ var SpriteAnimator = class SpriteAnimator extends Component {
1795
1867
  return true;
1796
1868
  }
1797
1869
  /**
1870
+ * Shows the frame of a clip that plays `seconds` into it, without playing it: {@link
1871
+ * SpriteAnimator.sample} at the frame `spriteClipFrameAtTime` picks, at this animator's `speed`.
1872
+ * A looping clip wraps and a one-shot clip holds its first or last frame.
1873
+ *
1874
+ * @param name - The clip's name.
1875
+ * @param seconds - How far into the clip, in seconds.
1876
+ * @returns `true` when the frame was written; `false` while the document or the atlas is still
1877
+ * loading, or when the clip has no frames.
1878
+ * @throws IgnifxError with code `IGX-1108` when the document declares no such clip.
1879
+ *
1880
+ * @example
1881
+ * ```ts
1882
+ * animator.sampleTime("run", 0.25);
1883
+ * ```
1884
+ */
1885
+ sampleTime(name, seconds) {
1886
+ const clips = this.asset;
1887
+ const atlas = this.#atlas();
1888
+ if (clips === null || atlas === null) return false;
1889
+ const clip = clips.requireClip(name, atlas);
1890
+ const timing = {
1891
+ frameCount: clip.frames.length,
1892
+ fps: clip.fps,
1893
+ loop: clip.loop
1894
+ };
1895
+ return this.sample(name, spriteClipFrameAtTime(timing, seconds, this.speed));
1896
+ }
1897
+ /**
1798
1898
  * Advances playback by one frame's worth of scaled time. The animation system calls this in
1799
1899
  * `PostUpdate`.
1800
1900
  *
@@ -2339,17 +2439,14 @@ function clampCount(value) {
2339
2439
  *
2340
2440
  * A frame's `pivot` is used as-is when the document declares one: TexturePacker already writes
2341
2441
  * pivots normalised into `[0, 1]` against a top-left origin, which is exactly ignifx's convention.
2342
- * Frames without one get the centre. A frame marked `trimmed` carries its `sourceSize` through so
2343
- * the loader can lay the trimmed rectangle back inside its original bounds.
2442
+ * Frames without one get the centre. A frame marked `trimmed` carries its `sourceSize` and, from
2443
+ * `spriteSourceSize.x`/`.y`, its `sourceOffset` through, so the trimmed pixels draw where the
2444
+ * untrimmed frame would have put them.
2344
2445
  *
2345
2446
  * @remarks
2346
2447
  * Rotated frames are rejected rather than silently drawn wrong — the sprite pipeline has no
2347
2448
  * per-frame rotation flag.
2348
2449
  *
2349
- * `spriteSourceSize`'s **offset** (`x`/`y`) has no home in `SpriteFrameDefinition`, which records
2350
- * only the untrimmed size, so a trimmed frame whose art is not centred in its source bounds may sit
2351
- * slightly off. Pack with trimming disabled, or with `spriteSourceSize` centred, when that matters.
2352
- *
2353
2450
  * @param json - The parsed TexturePacker document.
2354
2451
  * @param options - The image override, name handling, and sampling.
2355
2452
  * @returns The complete atlas document.
@@ -2382,6 +2479,7 @@ function importTexturePackerAtlas(json, options) {
2382
2479
  if (rect === null) failImport$1(importer, `frame ${item.key} has no {x, y, w, h} frame rectangle`);
2383
2480
  const pivot = readVec2$1(item.entry, "pivot") ?? CENTRE_PIVOT$2;
2384
2481
  const sourceSize = item.entry["trimmed"] === true ? readSize(item.entry, "sourceSize") : null;
2482
+ const sourceOffset = sourceSize === null ? null : readVec2$1(item.entry, "spriteSourceSize");
2385
2483
  frames.push({
2386
2484
  name: keepExtensions ? item.key : stripFileExtension(item.key),
2387
2485
  x: rect.x,
@@ -2392,7 +2490,8 @@ function importTexturePackerAtlas(json, options) {
2392
2490
  x: pivot.x,
2393
2491
  y: pivot.y
2394
2492
  },
2395
- ...sourceSize === null ? {} : { sourceSize }
2493
+ ...sourceSize === null ? {} : { sourceSize },
2494
+ ...sourceOffset === null ? {} : { sourceOffset }
2396
2495
  });
2397
2496
  }
2398
2497
  return defineSpriteAtlas({
@@ -2426,8 +2525,8 @@ function resolveImage(override, meta, importer) {
2426
2525
  * is put through {@link asepriteFrameName}; `importAsepriteAnimations` uses the same normaliser,
2427
2526
  * which is what makes the imported clips and the imported atlas agree on names.
2428
2527
  *
2429
- * A trimmed frame keeps its `sourceSize` so the loader can place the trimmed rectangle back inside
2430
- * its original bounds.
2528
+ * A trimmed frame keeps its `sourceSize` and its `sourceOffset` (from `spriteSourceSize.x`/`.y`), so
2529
+ * the trimmed pixels draw where the untrimmed frame would have put them.
2431
2530
  *
2432
2531
  * @remarks
2433
2532
  * Pivots are **best-effort**. Aseprite has no per-frame pivot; it has slices, which carry an
@@ -2469,6 +2568,7 @@ function importAsepriteAtlas(json, options) {
2469
2568
  if (rect === null) failImport$1(importer, `frame ${item.key} has no {x, y, w, h} frame rectangle`);
2470
2569
  const declaredSource = readSize(item.entry, "sourceSize");
2471
2570
  const trimmed = item.entry["trimmed"] === true;
2571
+ const declaredOffset = declaredSource === null ? null : readVec2$1(item.entry, "spriteSourceSize");
2472
2572
  const sourceWidth = declaredSource === null ? rect.w : declaredSource.x;
2473
2573
  const sourceHeight = declaredSource === null ? rect.h : declaredSource.y;
2474
2574
  const pivot = slicePivotFor(slicePivots, index, sourceWidth, sourceHeight) ?? CENTRE_PIVOT$2;
@@ -2482,7 +2582,8 @@ function importAsepriteAtlas(json, options) {
2482
2582
  x: pivot.x,
2483
2583
  y: pivot.y
2484
2584
  },
2485
- ...trimmed && declaredSource !== null ? { sourceSize: declaredSource } : {}
2585
+ ...trimmed && declaredSource !== null ? { sourceSize: declaredSource } : {},
2586
+ ...trimmed && declaredOffset !== null ? { sourceOffset: declaredOffset } : {}
2486
2587
  });
2487
2588
  }
2488
2589
  return defineSpriteAtlas({
@@ -3015,14 +3116,14 @@ function toRects(definition) {
3015
3116
  h: frame.h,
3016
3117
  pivotX: readVec2(frame.pivot, CENTRE_PIVOT$1).x,
3017
3118
  pivotY: readVec2(frame.pivot, CENTRE_PIVOT$1).y,
3018
- sourceW: readVec2(frame.sourceSize, {
3119
+ sourceW: frame.sourceOffset === void 0 ? readVec2(frame.sourceSize, {
3019
3120
  x: frame.w,
3020
3121
  y: frame.h
3021
- }).x,
3022
- sourceH: readVec2(frame.sourceSize, {
3122
+ }).x : frame.w,
3123
+ sourceH: frame.sourceOffset === void 0 ? readVec2(frame.sourceSize, {
3023
3124
  x: frame.w,
3024
3125
  y: frame.h
3025
- }).y
3126
+ }).y : frame.h
3026
3127
  });
3027
3128
  }
3028
3129
  return rects;
@@ -3334,6 +3435,34 @@ function pivotedPositionToRef(anchorXPx, anchorYPx, pivot, widthPx, heightPx, ro
3334
3435
  out.y = anchorYPx + offsetX * sin + offsetY * cos;
3335
3436
  return out;
3336
3437
  }
3438
+ /**
3439
+ * Turns a trimmed frame's pivot, given in `[0, 1]` of its untrimmed source, into the pivot of the
3440
+ * trimmed rectangle that is actually drawn, so {@link pivotedPositionToRef} places the trimmed
3441
+ * pixels exactly where the untrimmed frame would have put them.
3442
+ *
3443
+ * @remarks
3444
+ * A flip mirrors the pixels inside the drawn quad, so it mirrors where the trimmed rectangle sits
3445
+ * in its source too: a flipped trimmed frame then matches the flipped untrimmed one. The result may
3446
+ * fall outside `[0, 1]`, which the placement handles.
3447
+ *
3448
+ * @param pivot - The pivot in `[0, 1]` of the untrimmed source.
3449
+ * @param trim - Where the trimmed rectangle sits in its source.
3450
+ * @param widthPx - The trimmed width, in image pixels.
3451
+ * @param heightPx - The trimmed height, in image pixels.
3452
+ * @param flipX - Whether the sprite is mirrored horizontally.
3453
+ * @param flipY - Whether the sprite is mirrored vertically.
3454
+ * @param out - The vector to write.
3455
+ * @returns `out`: the pivot in `[0, 1]` of the trimmed rectangle.
3456
+ *
3457
+ * @internal
3458
+ */
3459
+ function trimmedPivotToRef(pivot, trim, widthPx, heightPx, flipX, flipY, out) {
3460
+ const offsetX = flipX ? trim.sourceWidthPx - trim.offsetXPx - widthPx : trim.offsetXPx;
3461
+ const offsetY = flipY ? trim.sourceHeightPx - trim.offsetYPx - heightPx : trim.offsetYPx;
3462
+ out.x = widthPx > 0 ? (pivot.x * trim.sourceWidthPx - offsetX) / widthPx : .5;
3463
+ out.y = heightPx > 0 ? (pivot.y * trim.sourceHeightPx - offsetY) / heightPx : .5;
3464
+ return out;
3465
+ }
3337
3466
  //#endregion
3338
3467
  //#region src/camera/camera-2d.ts
3339
3468
  /**
@@ -6248,6 +6377,8 @@ var TwoDSyncSystem = class {
6248
6377
  #scratch = createSpriteScratch();
6249
6378
  #pixels = new Vec2();
6250
6379
  #position = new Vec2();
6380
+ /** The drawn pivot of a trimmed frame, reused every sprite. */
6381
+ #trimmedPivot = new Vec2();
6251
6382
  #boundsMin = new Vec2();
6252
6383
  #boundsMax = new Vec2();
6253
6384
  /** Sprites seen this frame, so the ones that vanished can be dropped. */
@@ -6405,7 +6536,9 @@ var TwoDSyncSystem = class {
6405
6536
  const widthPx = frameWidth * scaleX;
6406
6537
  const heightPx = frameHeight * scaleY;
6407
6538
  const anchor = worldToPixelsToRef(worldX, worldY, pixelsPerUnit, this.#pixels);
6408
- const pivot = sprite.pivotOverride ?? info?.pivot ?? CENTRE_PIVOT;
6539
+ const declaredPivot = sprite.pivotOverride ?? info?.pivot ?? CENTRE_PIVOT;
6540
+ const trim = info?.trim ?? null;
6541
+ const pivot = trim === null ? declaredPivot : trimmedPivotToRef(declaredPivot, trim, frameWidth, frameHeight, sprite.flipX, sprite.flipY, this.#trimmedPivot);
6409
6542
  const placed = pivotedPositionToRef(anchor.x, anchor.y, pivot, widthPx, heightPx, rotation, this.#position);
6410
6543
  const tint = sprite.color;
6411
6544
  writeScratch(this.#scratch, placed.x, placed.y, widthPx, heightPx, frame, rotation, tint.r, tint.g, tint.b, tint.a, sprite.flipX, sprite.flipY, sprite.isEnabledInHierarchy);
@@ -7225,7 +7358,7 @@ function spriteClearColor(app) {
7225
7358
  *
7226
7359
  * @public
7227
7360
  */
7228
- const VERSION = "0.15.0";
7361
+ const VERSION = "0.16.0";
7229
7362
  //#endregion
7230
7363
  //#region src/extension.ts
7231
7364
  /**
@@ -7457,8 +7590,12 @@ function spriteAtlasFileSchema() {
7457
7590
  sourceSize: vec2({
7458
7591
  x: 0,
7459
7592
  y: 0
7460
- }, { tooltip: "The untrimmed size, when the packer trimmed the frame." })
7461
- }), [], { tooltip: "The frames, in the order they are indexed. Each is a record of name (str, what SpriteRenderer.frameName names), x/y (f32, the top-left corner in image pixels), w/h (f32, the size in image pixels), pivot (vec2 in [0,1] of the frame; [0,0] is top-left) and sourceSize (vec2, the untrimmed size when the packer trimmed the frame)." })
7593
+ }, { tooltip: "The untrimmed size, when the packer trimmed the frame." }),
7594
+ sourceOffset: vec2({
7595
+ x: 0,
7596
+ y: 0
7597
+ }, { tooltip: "The trimmed rectangle's top-left inside the untrimmed source, in pixels; needs sourceSize." })
7598
+ }), [], { tooltip: "The frames, in the order they are indexed. Each is a record of name (str, what SpriteRenderer.frameName names), x/y (f32, the top-left corner in image pixels), w/h (f32, the size in image pixels), pivot (vec2 in [0,1] of the frame; [0,0] is top-left) sourceSize (vec2, the untrimmed size when the packer trimmed the frame) and sourceOffset (vec2, the trimmed rectangle's top-left inside that source, in pixels, as spriteSourceSize.x/y; with it the frame draws at w/h, offset to where the untrimmed frame would be, and its pivot is in [0,1] of sourceSize)." })
7462
7599
  });
7463
7600
  }
7464
7601
  /**
@@ -8633,6 +8770,6 @@ function readArray(source, key) {
8633
8770
  return isUnknownArray(value) ? value : [];
8634
8771
  }
8635
8772
  //#endregion
8636
- export { Camera2D, Camera2DFollow, DEFAULT_CHUNK_SIZE, DEFAULT_CLIP_FPS, DEFAULT_ORTHOGRAPHIC_SIZE, DEFAULT_PICK_ALL_LIMIT, DEFAULT_PIXELS_PER_UNIT, DEFAULT_REFERENCE_RESOLUTION, DEFAULT_SORTING_LAYER, EMPTY_TILE_ID, LDTK_DEFAULT_INTGRID_COLLIDERS, LDTK_INTGRID_TILESET_NAME, ParallaxLayer, SORTING_LAYER_ORDER_STEP, SPRITE_ANIMATION_ASSET_TYPE, SPRITE_ANIMATION_FILE_EXTENSIONS, SPRITE_ANIMATION_FORMAT, SPRITE_ANIMATION_FORMAT_VERSION, SPRITE_ATLAS_ASSET_TYPE, SPRITE_ATLAS_FILE_EXTENSIONS, SPRITE_ATLAS_FORMAT, SPRITE_ATLAS_FORMAT_VERSION, SPRITE_BLEND_MODES, SPRITE_EFFECT_KINDS, SPRITE_FRAME_FRAGMENT_PREFIX, SortingLayerTable, SpriteAnimationAsset, SpriteAnimator, SpriteAtlasAsset, SpriteLayerEffect, SpriteLayerRegistry, SpriteRenderer, TILEMAP_ASSET_TYPE, TILEMAP_FILE_EXTENSIONS, TILEMAP_FORMAT, TILEMAP_FORMAT_VERSION, TINT_EFFECT_WGSL, TWO_D_ANIMATION_ORDER, TWO_D_ERROR_MESSAGES, TWO_D_MODES, TWO_D_SETTINGS_SECTION, TWO_D_SYNC_ORDER, Tilemap, TilemapAsset, TilemapRenderer, TwoDAnimationSystem, TwoDErrorCode, TwoDService, TwoDSyncSystem, VERSION, asepriteFrameName, createSpriteAnimationLoader, createSpriteAtlasLoader, createTilemapLoader, decodeTileRle, defaultTwoDSettings, defineSpriteAnimation, defineSpriteAtlas, defineTilemap, describeSchemas, describeSpriteAnimationFormat, describeSpriteAtlasFormat, describeTilemapFormat, describeTwoDSchemas, encodeTileRle, fieldInstancesToRecord, findTileset, gridAtlas, importAsepriteAnimations, importAsepriteAtlas, importLdtkLevel, importTexturePackerAtlas, importTiledMap, isFullCellSolid, mergeTileCollisions, normalisePath, parseSpriteFragment, pivotedPositionToRef, pixelsToWorldToRef, readVec2, resolveClipFrames, resolveRelative, selectCamera, sizeForZoom, snapPixel, snapZoomToInteger, spriteAnimationFileSchema, spriteAnimationJsonSchema, spriteAtlasFileSchema, spriteAtlasJsonSchema, spriteLayerKey, spriteRotationFromLite, spriteRotationToLite, tileCollisionInfo, tileFrameName, tiledPropertiesToRecord, tilemapFileSchema, tilemapJsonSchema, twoD, twoDError, twoDSettingsSchema, viewRotationToLite, worldToPixelsToRef, zoomForSize };
8773
+ export { Camera2D, Camera2DFollow, DEFAULT_CHUNK_SIZE, DEFAULT_CLIP_FPS, DEFAULT_ORTHOGRAPHIC_SIZE, DEFAULT_PICK_ALL_LIMIT, DEFAULT_PIXELS_PER_UNIT, DEFAULT_REFERENCE_RESOLUTION, DEFAULT_SORTING_LAYER, EMPTY_TILE_ID, LDTK_DEFAULT_INTGRID_COLLIDERS, LDTK_INTGRID_TILESET_NAME, ParallaxLayer, SORTING_LAYER_ORDER_STEP, SPRITE_ANIMATION_ASSET_TYPE, SPRITE_ANIMATION_FILE_EXTENSIONS, SPRITE_ANIMATION_FORMAT, SPRITE_ANIMATION_FORMAT_VERSION, SPRITE_ATLAS_ASSET_TYPE, SPRITE_ATLAS_FILE_EXTENSIONS, SPRITE_ATLAS_FORMAT, SPRITE_ATLAS_FORMAT_VERSION, SPRITE_BLEND_MODES, SPRITE_EFFECT_KINDS, SPRITE_FRAME_FRAGMENT_PREFIX, SortingLayerTable, SpriteAnimationAsset, SpriteAnimator, SpriteAtlasAsset, SpriteLayerEffect, SpriteLayerRegistry, SpriteRenderer, TILEMAP_ASSET_TYPE, TILEMAP_FILE_EXTENSIONS, TILEMAP_FORMAT, TILEMAP_FORMAT_VERSION, TINT_EFFECT_WGSL, TWO_D_ANIMATION_ORDER, TWO_D_ERROR_MESSAGES, TWO_D_MODES, TWO_D_SETTINGS_SECTION, TWO_D_SYNC_ORDER, Tilemap, TilemapAsset, TilemapRenderer, TwoDAnimationSystem, TwoDErrorCode, TwoDService, TwoDSyncSystem, VERSION, asepriteFrameName, createSpriteAnimationLoader, createSpriteAtlasLoader, createTilemapLoader, decodeTileRle, defaultTwoDSettings, defineSpriteAnimation, defineSpriteAtlas, defineTilemap, describeSchemas, describeSpriteAnimationFormat, describeSpriteAtlasFormat, describeTilemapFormat, describeTwoDSchemas, encodeTileRle, fieldInstancesToRecord, findTileset, gridAtlas, importAsepriteAnimations, importAsepriteAtlas, importLdtkLevel, importTexturePackerAtlas, importTiledMap, isFullCellSolid, mergeTileCollisions, normalisePath, parseSpriteFragment, pivotedPositionToRef, pixelsToWorldToRef, readVec2, resolveClipFrames, resolveRelative, selectCamera, sizeForZoom, snapPixel, snapZoomToInteger, spriteAnimationFileSchema, spriteAnimationJsonSchema, spriteAtlasFileSchema, spriteAtlasJsonSchema, spriteClipFrameAtTime, spriteLayerKey, spriteRotationFromLite, spriteRotationToLite, tileCollisionInfo, tileFrameName, tiledPropertiesToRecord, tilemapFileSchema, tilemapJsonSchema, twoD, twoDError, twoDSettingsSchema, viewRotationToLite, worldToPixelsToRef, zoomForSize };
8637
8774
 
8638
8775
  //# sourceMappingURL=index.js.map