@combos-fun/plugin-transition 0.0.5 → 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-transition
2
2
 
3
- Internal workspace package (Combos Fun monorepo).
3
+ @combos-fun/plugin-transition part of the Combos Fun engine monorepo.
4
+
5
+ Keywords: `tween`, `animation`, `easing`, `transition`, `property`.
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-transition/plugin-manifest';
21
+ // or fetch the markdown directly:
22
+ // require.resolve('@combos-fun/plugin-transition/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,112 @@
1
+ # `@combos-fun/plugin-transition` — Agent notes
2
+
3
+ Data-driven tween / property animation. Tweens any numeric Component
4
+ property via dot-path (e.g. `positionX`, `rotationY`, `alpha`). No
5
+ rendering dependency — works with both 2D and 3D pipelines.
6
+
7
+ ## When to read
8
+
9
+ Read for any tween / motion / value animation: button bounce, fade-in /
10
+ out, easing curves on transforms, scripted dialog motion.
11
+
12
+ ## Public API
13
+
14
+ ```ts
15
+ import { Transition, TransitionSystem } from '@combos-fun/plugin-transition';
16
+ ```
17
+
18
+ `componentName = 'Transition'`,
19
+ **`systemName = 'transition'` (lowercase)** — use the class reference with
20
+ `game.getSystem(TransitionSystem)`, not the string.
21
+
22
+ ### Init params
23
+
24
+ ```ts
25
+ {
26
+ group: Record<string, AnimationStruct[]>;
27
+ }
28
+
29
+ interface AnimationStruct {
30
+ name: string;
31
+ component: ComponentClass;
32
+ values: { time: number; value: any; tween?: EasingName }[];
33
+ }
34
+ ```
35
+
36
+ `values` is a keyframe list. `time` is the timestamp on the timeline,
37
+ `value` is the target value, `tween` selects easing for the segment ending
38
+ at this keyframe.
39
+
40
+ ### Methods
41
+
42
+ `play(name?, iteration?)` — play a named animation; pass `name` undefined
43
+ to play all. `stop(name?)` — stop one or all.
44
+
45
+ ### Events
46
+
47
+ `'finish'` is emitted with the animation name when iteration count is
48
+ reached.
49
+
50
+ ### Easing names
51
+
52
+ `linear`, `ease-in`, `ease-out`, `ease-in-out`, `bounce-in`,
53
+ `bounce-out`, `bounce-in-out`, `none`.
54
+
55
+ ## Required setup
56
+
57
+ `TransitionSystem` is a stub — the heavy lifting happens inside the
58
+ `Transition` component's `update()`. You still need to register it so the
59
+ engine routes lifecycle hooks correctly.
60
+
61
+ ```ts
62
+ new Game({
63
+ systems: [/* ...renderer / physics ... */, new TransitionSystem()],
64
+ });
65
+ ```
66
+
67
+ ## Runtime behaviour
68
+
69
+ - The component reads / writes target Component fields via dot-path each
70
+ frame, using the easing function for the current segment.
71
+ - `'finish'` fires when iteration count is exhausted; for an infinite
72
+ loop, pass `iteration = 0` (or omit) — `'finish'` will not fire.
73
+ - Tween source data is registered up-front in `group`; modify it
74
+ imperatively only when needed (the system observes the component).
75
+
76
+ ## Common pitfalls
77
+
78
+ | Symptom | Fix |
79
+ |---------|-----|
80
+ | `getSystem('transition')` returns undefined | Use class reference: `game.getSystem(TransitionSystem)` |
81
+ | Tween jumps to final value | Add intermediate keyframes; `time` must be increasing |
82
+ | Tween fires on wrong component | The `component` field in each `AnimationStruct` is the **target Component class**, not a Component instance |
83
+ | Pause / resume drifts | Tween uses internal timeline; pause via `Game.pause()` covers it correctly |
84
+
85
+ ## Minimal example
86
+
87
+ ```ts
88
+ import { Transition, TransitionSystem } from '@combos-fun/plugin-transition';
89
+ import { Transform } from '@combos-fun/engine';
90
+
91
+ const go = new GameObject('moving-box');
92
+ go.addComponent(new Transform({ position: { x: 0, y: 0 } }));
93
+ go.addComponent(new Transition({
94
+ group: {
95
+ slideRight: [{
96
+ name: 'slideRight',
97
+ component: Transform,
98
+ values: [
99
+ { time: 0, value: { positionX: 0 } },
100
+ { time: 1000, value: { positionX: 500 }, tween: 'ease-in-out' },
101
+ ],
102
+ }],
103
+ },
104
+ }));
105
+
106
+ // Trigger from a Component lifecycle hook (not bootstrap):
107
+ // gameObject.getComponent(Transition)?.play('slideRight', 1);
108
+ ```
109
+
110
+ ## Verification
111
+
112
+ `pnpm --filter @combos-fun/plugin-transition run build`.
@@ -0,0 +1,11 @@
1
+ {
2
+ "name": "@combos-fun/plugin-transition",
3
+ "pluginId": "transition",
4
+ "category": "animation",
5
+ "dimension": "shared",
6
+ "isCore": false,
7
+ "keywords": ["tween", "animation", "easing", "transition", "property"],
8
+ "agentSkill": "./agent-skill.md",
9
+ "requires": ["@combos-fun/engine"],
10
+ "exports": ["Transition", "TransitionSystem"]
11
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@combos-fun/plugin-transition",
3
- "version": "0.0.5",
3
+ "version": "0.0.7",
4
4
  "description": "@combos-fun/plugin-transition",
5
5
  "main": "index.js",
6
6
  "module": "dist/plugin-transition.esm.js",
@@ -8,8 +8,22 @@
8
8
  "unpkg": "dist/CombosFun.plugin.transition.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-transition.esm.js",
18
+ "require": "./index.js",
19
+ "types": "./dist/plugin-transition.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-transition.d.ts",
14
28
  "keywords": [
15
29
  "combos-fun",
@@ -19,7 +33,7 @@
19
33
  "dependencies": {
20
34
  "@tweenjs/tween.js": "^25.0.0",
21
35
  "sprite-timeline": "^1.10.2",
22
- "@combos-fun/engine": "0.0.5"
36
+ "@combos-fun/engine": "0.0.7"
23
37
  },
24
38
  "scripts": {
25
39
  "build": "node ../../scripts/build-package.mjs"