@combos-fun/plugin-renderer-sprite-animation 0.1.15 → 0.1.17

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.
Files changed (2) hide show
  1. package/agent-skill.md +11 -27
  2. package/package.json +5 -5
package/agent-skill.md CHANGED
@@ -1,38 +1,22 @@
1
1
  # `@combos-fun/plugin-renderer-sprite-animation` — Agent notes
2
2
 
3
- Read only for flipbook playback of atlas frames. Use `Sprite` when exactly one atlas frame should be shown.
3
+ Atlas flipbook. One frame uses `Sprite`.
4
4
 
5
5
  ```ts
6
- import {
7
- SpriteAnimation,
8
- SpriteAnimationSystem,
9
- type SpriteAnimationParams,
10
- } from '@combos-fun/plugin-renderer-sprite-animation';
6
+ import { SpriteAnimation, SpriteAnimationSystem } from '@combos-fun/plugin-renderer-sprite-animation';
11
7
  ```
12
8
 
13
- `SpriteAnimation.componentName = 'SpriteAnimation'`; `SpriteAnimationSystem.systemName = 'SpriteAnimation'`.
9
+ `SpriteAnimation.componentName = 'SpriteAnimation'`. `SpriteAnimationSystem.systemName = 'SpriteAnimation'`.
14
10
 
15
- | Field | Type | Default |
16
- |---|---|---|
17
- | `resource` | `string` | required SPRITE_ANIMATION name |
18
- | `autoPlay` | `boolean?` | `true` |
19
- | `speed` | `number?` | `100` ms/frame |
20
- | `forwards` | `boolean?` | `false` |
11
+ | Field | Default |
12
+ | --- | --- |
13
+ | `resource` | required `SPRITE_ANIMATION` name |
14
+ | `autoPlay` | `true` |
15
+ | `speed` | `100` ms/frame |
16
+ | `forwards` | `false` |
21
17
 
22
- Importing the package registers SPRITE_ANIMATION atlas parsing. The implementation parses **all** entries in JSON `frames` and plays the resulting frame-key order. It rewrites JSON `animations` keys but does not expose a clip selector and does not choose an animation by clip name. Use separate resources if distinct clips need independent playback.
23
-
24
- Methods are `play(times?)`, `stop()`, `gotoAndPlay(frame)`, and `gotoAndStop(frame)`; getters are `currentFrame` and `totalFrames`. `play()`/`play(Infinity)` loops, `play(N > 0)` completes after N loops, and `play(0)` is a no-op. With finite playback, `forwards: true` stops on the last frame; otherwise it resets.
25
-
26
- `play()` and `stop()` safely queue while the atlas loads. **`gotoAndPlay()` and `gotoAndStop()` do not queue and dereference the animation immediately, so calling them before async atlas readiness is unsafe.** Wait until the component has an animation/positive `totalFrames`.
27
-
28
- Events are `'loop'`, `'frameChange'`, and `'complete'` (no payload is forwarded). `'complete'` from the Component's finite-loop logic does not occur during infinite playback.
18
+ Plays every JSON `frames` entry in key order. It rewrites `animations` keys and has no clip selector; use a separate resource per clip. `play()` / `play(Infinity)` loops. `play(n)` runs n loops. `play(0)` does nothing. Finite playback with `forwards: true` stops on the last frame. `play` and `stop` queue while the atlas loads. `gotoAndPlay` / `gotoAndStop` do not; wait for `totalFrames > 0`. Getters: `currentFrame`, `totalFrames`. Events `loop`, `frameChange`, `complete` carry no payload. `complete` does not fire during infinite playback. Size follows `Transform2D.size`. Observes `resource` and `speed`, not `autoPlay` or `forwards`.
29
19
 
30
20
  ```ts
31
- hero.addComponent(new SpriteAnimation({
32
- resource: 'hero-run',
33
- autoPlay: true,
34
- speed: 80,
35
- }));
21
+ hero.addComponent(new SpriteAnimation({ resource: 'hero-run', speed: 80 }));
36
22
  ```
37
-
38
- Display width and height follow `Transform2D.size`, not frame pixels. Resource or speed changes are observed; `autoPlay` and `forwards` are not observer fields.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@combos-fun/plugin-renderer-sprite-animation",
3
- "version": "0.1.15",
3
+ "version": "0.1.17",
4
4
  "description": "Frame-based sprite animation",
5
5
  "main": "index.js",
6
6
  "module": "dist/plugin-renderer-sprite-animation.esm.js",
@@ -37,10 +37,10 @@
37
37
  "author": "sun668 <q947692259@gmail.com>",
38
38
  "dependencies": {
39
39
  "pixi.js": "^8.18.1",
40
- "@combos-fun/plugin-renderer": "0.1.15",
41
- "@combos-fun/engine": "0.1.15",
42
- "@combos-fun/renderer-adapter": "0.1.15",
43
- "@combos-fun/inspector-decorator": "0.1.15"
40
+ "@combos-fun/plugin-renderer": "0.1.17",
41
+ "@combos-fun/renderer-adapter": "0.1.17",
42
+ "@combos-fun/inspector-decorator": "0.1.17",
43
+ "@combos-fun/engine": "0.1.17"
44
44
  },
45
45
  "scripts": {
46
46
  "build": "node ../../scripts/build-package.mjs"