@ignifx/2d 0.14.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 +99 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +159 -22
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/skills/2d/SKILL.md +9 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ignifx/2d",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.0",
|
|
4
4
|
"description": "ignifx 2D toolkit: Camera2D, sprites, sprite animation, atlases, tilemaps, sorting layers, pixel-perfect, parallax.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ignifx",
|
|
@@ -43,11 +43,11 @@
|
|
|
43
43
|
"typedoc-plugin-markdown": "^4.13.0",
|
|
44
44
|
"typescript-native": "npm:typescript@7.0.2",
|
|
45
45
|
"vitest": "^5.0.0",
|
|
46
|
-
"@ignifx/core": "0.
|
|
46
|
+
"@ignifx/core": "0.16.0"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
49
|
"@babylonjs/lite": "1.34.0",
|
|
50
|
-
"@ignifx/core": "0.
|
|
50
|
+
"@ignifx/core": "0.16.0"
|
|
51
51
|
},
|
|
52
52
|
"ignifx": {
|
|
53
53
|
"extension": true,
|
package/skills/2d/SKILL.md
CHANGED
|
@@ -3,7 +3,7 @@ name: 2d
|
|
|
3
3
|
description: Builds 2D games in ignifx with @ignifx/2d: Camera2D, SpriteRenderer, SpriteAnimator, texture atlases, Tilemap rendering and import, sorting layers and Y-sort, pixel-perfect cameras, parallax layers, sprite batches, and 2D picking. Use when adding or editing sprites, sprite animation, tilemaps, atlases, sorting layers, sprite batches, or a 2D camera in an ignifx project, or when the user mentions @ignifx/2d, Camera2D, SpriteRenderer, SpriteBatch, or Tilemap.
|
|
4
4
|
license: Apache-2.0
|
|
5
5
|
metadata:
|
|
6
|
-
ignifx-version: "0.
|
|
6
|
+
ignifx-version: "0.16.0"
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
# @ignifx/2d
|
|
@@ -21,7 +21,7 @@ parse, `SpriteAnimator` advances on the stepped clock. Only the pixels need a GP
|
|
|
21
21
|
|
|
22
22
|
## Environment
|
|
23
23
|
|
|
24
|
-
- Engine: ignifx `0.
|
|
24
|
+
- Engine: ignifx `0.16.0`; this package targets `@ignifx/core` `>=0.0.0 <1.0.0`.
|
|
25
25
|
- WebGPU only, browser and Electron. Babylon Lite `1.34.0` is a peer dependency.
|
|
26
26
|
- Register it like any extension; nothing happens at import time.
|
|
27
27
|
|
|
@@ -130,7 +130,7 @@ Full signatures: `skills/ignifx/references/api/2d.md`.
|
|
|
130
130
|
| ------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
131
131
|
| `Camera2D` (`ignifx/Camera2D`) | `orthographicSize`, `pixelPerfect`, `referenceResolution`, `boundsMin`/`boundsMax`, `follow`, `deadZone`, `priority` |
|
|
132
132
|
| `SpriteRenderer` (`ignifx/SpriteRenderer`) | `sprite`, `frameName`, `color`, `flipX`/`flipY`, `sortingLayer`, `orderInLayer`, `blend`, `pivotOverride`, `screenSpace`, `pickable`; runtime `frame` |
|
|
133
|
-
| `SpriteAnimator` (`ignifx/SpriteAnimator`) | `animations`, `defaultClip`, `playOnAwake`, `speed`; `play`/`stop`/`pause`/`resume`/`sample`, `onClipEnded`, `onEvent`
|
|
133
|
+
| `SpriteAnimator` (`ignifx/SpriteAnimator`) | `animations`, `defaultClip`, `playOnAwake`, `speed`; `play`/`stop`/`pause`/`resume`/`sample`/`sampleTime`, `onClipEnded`, `onEvent` |
|
|
134
134
|
| `Tilemap` (`ignifx/Tilemap`) | `map`, `chunkSize`; `getTile`/`setTile`/`setCells`, `worldToCell`/`cellToWorld`, `collisionData`, `onTileChanged` |
|
|
135
135
|
| `TilemapRenderer` (`ignifx/TilemapRenderer`) | `atlas`, `sortingLayer`, `cullChunks` |
|
|
136
136
|
| `ParallaxLayer` (`ignifx/ParallaxLayer`) | `sortingLayer`, `factor`, `repeatX`/`repeatY`, `repeatWidth`/`repeatHeight` |
|
|
@@ -309,9 +309,11 @@ export function clearRect(map: Tilemap, layer: number, x0: number, y0: number, x
|
|
|
309
309
|
Generated reference: `skills/ignifx/references/formats/`.
|
|
310
310
|
|
|
311
311
|
- **`.atlas.json`** (`ignifx.spriteatlas`) — `image` (an address relative to the document, resolved through the manifest; `/x.png` and URLs verbatim), `sampling`,
|
|
312
|
-
`premultipliedAlpha`, and `frames: [{ name, x, y, w, h, pivot?, sourceSize? }]` in **image pixels
|
|
312
|
+
`premultipliedAlpha`, and `frames: [{ name, x, y, w, h, pivot?, sourceSize?, sourceOffset? }]` in **image pixels
|
|
313
313
|
with a top-left origin**. A pivot is `[x, y]` or `{ x, y }` in `[0, 1]` of the frame; `[0, 0]` is
|
|
314
|
-
top-left. A `
|
|
314
|
+
top-left. A trimmed frame sets `sourceSize` (the untrimmed size) and `sourceOffset` (where the
|
|
315
|
+
trimmed rectangle's top-left sits in it, TexturePacker's `spriteSourceSize.x/y`): it then draws at
|
|
316
|
+
`w`/`h`, exactly where the untrimmed frame would, and its pivot is in `[0, 1]` of `sourceSize`. A `SpriteRenderer` picks a frame by name with `frameName`. A
|
|
315
317
|
`"2d/hero.atlas.json#frame:idle_0"` address loads a `SpriteAsset` for code; it is not a sprite.
|
|
316
318
|
- **`.spriteanim.json`** (`ignifx.spriteanimation`) — `atlas` plus
|
|
317
319
|
`clips: [{ name, frames | from/to, fps, loop, events }]`. An event's `frame` is the index **within
|
|
@@ -374,6 +376,8 @@ Generated reference: `skills/ignifx/references/formats/`.
|
|
|
374
376
|
- **In an edit-mode app (`createApp({ editMode: true })`) clips and animated tiles do not play.**
|
|
375
377
|
The renderer keeps its authored `frameName`. To preview one, call `animator.sample("run", 2)`: it writes
|
|
376
378
|
that frame, stops there, and fires no event; `resume()` plays on from it. It works in a game too.
|
|
379
|
+
`animator.sampleTime("run", 0.25)` does the same for the frame that plays 0.25 s in (a looping clip
|
|
380
|
+
wraps, a one-shot clip holds its last frame); `spriteClipFrameAtTime` is that mapping on its own.
|
|
377
381
|
|
|
378
382
|
## Deprecated (current window)
|
|
379
383
|
|