@combos-fun/plugin-renderer-sprite-animation 0.0.6 → 0.0.7

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,3 +1,27 @@
1
1
  # @combos-fun/plugin-renderer-sprite-animation
2
2
 
3
- Internal workspace package (Combos Fun monorepo).
3
+ @combos-fun/plugin-renderer-sprite-animation part of the Combos Fun engine monorepo.
4
+
5
+ Keywords: `sprite`, `animation`, `flipbook`, `atlas`, `frame`, `2d`.
6
+
7
+ ## Documentation
8
+
9
+ - Per-package agent / developer notes: [`agent-skill.md`](./agent-skill.md)
10
+ - Machine-readable manifest: [`combos-plugin.json`](./combos-plugin.json)
11
+ (validated against `schemas/combos-plugin.schema.json` in the repo
12
+ root)
13
+ - Entry skill (single source of truth for AI agents working with this
14
+ monorepo): `skills/combos-engine-development/SKILL.md`
15
+
16
+ When consumed from npm, the manifest and agent notes are exposed as
17
+ stable subpaths:
18
+
19
+ ```ts
20
+ import manifest from '@combos-fun/plugin-renderer-sprite-animation/plugin-manifest';
21
+ // or fetch the markdown directly:
22
+ // require.resolve('@combos-fun/plugin-renderer-sprite-animation/agent-skill')
23
+ ```
24
+
25
+ ## License
26
+
27
+ Internal workspace package, part of the Combos Fun engine monorepo.
package/agent-skill.md ADDED
@@ -0,0 +1,67 @@
1
+ # `@combos-fun/plugin-renderer-sprite-animation` — Agent notes
2
+
3
+ Frame-based sprite animation for the 2D pipeline. Plays an ordered set of
4
+ frames from a Texture Packer atlas as a flipbook animation.
5
+
6
+ ## When to read
7
+
8
+ Read for any frame-by-frame animation: character idle / run / attack
9
+ loops, FX, particle bursts.
10
+
11
+ ## Public API
12
+
13
+ ```ts
14
+ import { SpriteAnimation, SpriteAnimationSystem, type SpriteAnimationParams } from '@combos-fun/plugin-renderer-sprite-animation';
15
+ ```
16
+
17
+ `componentName = 'SpriteAnimation'`, `systemName = 'SpriteAnimationSystem'`.
18
+
19
+ ### `SpriteAnimationParams`
20
+
21
+ | Field | Type | Default | Notes |
22
+ |-------|------|---------|-------|
23
+ | `resource` | `string` | — | Engine resource name registered with `RESOURCE_TYPE.SPRITE_ANIMATION`. `src` must include both `image` and `json`. |
24
+ | `autoPlay` | `boolean?` | `false` | |
25
+ | `speed` | `number?` | `100` | Milliseconds per frame |
26
+ | `forwards` | `boolean?` | `true` | Direction |
27
+
28
+ Methods: `play(times?)`, `stop()`, `gotoAndPlay(frame)`, `gotoAndStop(frame)`.
29
+ Read-only getters: `currentFrame`, `totalFrames`. Events:
30
+ `'complete'`, `'loop'`, `'frameChange'`.
31
+
32
+ Side effect: importing this package registers
33
+ `SPRITE_ANIMATION` resource handlers on the engine `resource` singleton.
34
+
35
+ ## Required setup
36
+
37
+ `RendererSystem` then `SpriteAnimationSystem`. Resource:
38
+
39
+ ```ts
40
+ resource.addResource([{
41
+ name: 'hero-run',
42
+ src: { image: 'hero-run.png', json: 'hero-run.json' },
43
+ preload: true,
44
+ }]);
45
+ ```
46
+
47
+ ## Common pitfalls
48
+
49
+ | Symptom | Fix |
50
+ |---------|-----|
51
+ | Animation doesn't start | `autoPlay: false` is the default — call `play()` from a Component lifecycle hook, or set `autoPlay: true` |
52
+ | Imperative `play()` from bootstrap | ECS violation — wire the call from a Component's `start()` |
53
+ | Stuck on first frame | Frames may be a single image; check JSON has multiple frame entries |
54
+ | Animation never completes | `play(0)` (or omitted `times`) loops forever; pass a positive integer for finite plays |
55
+ | `'complete'` doesn't fire | Only fires when `play(N)` finishes N iterations; not when looping forever |
56
+
57
+ ## Minimal example
58
+
59
+ ```ts
60
+ const hero = new GameObject('hero');
61
+ hero.addComponent(new Transform({ position: { x: 200, y: 400 } }));
62
+ hero.addComponent(new SpriteAnimation({ resource: 'hero-run', autoPlay: true, speed: 80 }));
63
+ ```
64
+
65
+ ## Verification
66
+
67
+ `pnpm --filter @combos-fun/plugin-renderer-sprite-animation run build`.
@@ -0,0 +1,11 @@
1
+ {
2
+ "name": "@combos-fun/plugin-renderer-sprite-animation",
3
+ "pluginId": "renderer-sprite-animation",
4
+ "category": "rendering",
5
+ "dimension": "2d",
6
+ "isCore": false,
7
+ "keywords": ["sprite", "animation", "flipbook", "atlas", "frame", "2d"],
8
+ "agentSkill": "./agent-skill.md",
9
+ "requires": ["@combos-fun/engine", "@combos-fun/plugin-renderer"],
10
+ "exports": ["SpriteAnimation", "SpriteAnimationSystem"]
11
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@combos-fun/plugin-renderer-sprite-animation",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "description": "@combos-fun/plugin-renderer-sprite-animation",
5
5
  "main": "index.js",
6
6
  "module": "dist/plugin-renderer-sprite-animation.esm.js",
@@ -8,8 +8,22 @@
8
8
  "unpkg": "dist/CombosFun.plugin.renderer.spriteAnimation.min.js",
9
9
  "files": [
10
10
  "index.js",
11
- "dist"
11
+ "dist",
12
+ "agent-skill.md",
13
+ "combos-plugin.json"
12
14
  ],
15
+ "exports": {
16
+ ".": {
17
+ "import": "./dist/plugin-renderer-sprite-animation.esm.js",
18
+ "require": "./index.js",
19
+ "types": "./dist/plugin-renderer-sprite-animation.d.ts"
20
+ },
21
+ "./plugin-manifest": "./combos-plugin.json",
22
+ "./agent-skill": "./agent-skill.md"
23
+ },
24
+ "combos": {
25
+ "pluginManifest": "./combos-plugin.json"
26
+ },
13
27
  "types": "dist/plugin-renderer-sprite-animation.d.ts",
14
28
  "keywords": [
15
29
  "combos-fun",
@@ -18,10 +32,10 @@
18
32
  "author": "sun668 <q947692259@gmail.com>",
19
33
  "dependencies": {
20
34
  "pixi.js": "^8.18.1",
21
- "@combos-fun/plugin-renderer": "0.0.6",
22
- "@combos-fun/inspector-decorator": "0.0.6",
23
- "@combos-fun/renderer-adapter": "0.0.6",
24
- "@combos-fun/engine": "0.0.6"
35
+ "@combos-fun/engine": "0.0.7",
36
+ "@combos-fun/plugin-renderer": "0.0.7",
37
+ "@combos-fun/renderer-adapter": "0.0.7",
38
+ "@combos-fun/inspector-decorator": "0.0.7"
25
39
  },
26
40
  "scripts": {
27
41
  "build": "node ../../scripts/build-package.mjs"