@haiyue/animation-spec 0.1.0 → 0.2.2

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 (80) hide show
  1. package/README.md +40 -6
  2. package/SPECIFICATION.md +12 -2
  3. package/bin/hya-live2d-convert.mjs +76 -0
  4. package/bin/{hya-convert.mjs → hya-lottie-convert.mjs} +1 -1
  5. package/dist/chunks/binary-DvuTJ_hy.js +1 -0
  6. package/dist/chunks/clip-baked-Dv-wjX9d.js +1 -0
  7. package/dist/chunks/errors-Bzs3GOD9.js +1 -0
  8. package/dist/chunks/expression-D1cKtNwM.js +1 -0
  9. package/dist/chunks/extensions-DxL4AxOC.js +1 -0
  10. package/dist/conversion.d.ts +1 -0
  11. package/dist/conversion.js +1 -0
  12. package/dist/cubism.d.ts +1 -0
  13. package/dist/cubism.js +1 -0
  14. package/dist/deformable2d.d.ts +1 -0
  15. package/dist/deformable2d.js +1 -0
  16. package/dist/hya-production.d.ts +1 -0
  17. package/dist/hya-production.js +1 -0
  18. package/dist/index.d.ts +1 -10
  19. package/dist/index.js +1 -2927
  20. package/dist/live2d/clip-baked.d.ts +1 -0
  21. package/dist/live2d/clip-baked.js +1 -0
  22. package/dist/live2d.d.ts +1 -0
  23. package/dist/live2d.js +1 -0
  24. package/dist/lottie.d.ts +1 -62
  25. package/dist/lottie.js +1 -2642
  26. package/dist/native3d.d.ts +1 -2
  27. package/dist/native3d.js +1 -907
  28. package/dist/shared.d.ts +2791 -0
  29. package/package.json +93 -69
  30. package/schema/animation.schema.json +104 -12
  31. package/schema/deformable-mesh-2d-extension.schema.json +18 -0
  32. package/schema/deformable-mesh-2d.contract.json +58 -0
  33. package/schema/hya-composition.schema.json +41 -0
  34. package/schema/parameterized-rig-2d.contract.json +63 -0
  35. package/schema/parameterized-rig-2d.schema.json +57 -0
  36. package/schema/parameterized-rig-census-map.json +128 -0
  37. package/schema/responsive-layout-2d-census-map.json +49 -0
  38. package/schema/responsive-layout-2d.contract.json +58 -0
  39. package/schema/responsive-layout-2d.schema.json +34 -0
  40. package/schema/state-machine-v2-census-map.json +1 -0
  41. package/schema/state-machine-v2.contract.json +66 -0
  42. package/schema/state-machine-v2.schema.json +55 -0
  43. package/schema/vector-visual-census-map.json +120 -0
  44. package/schema/vector-visual.contract.json +47 -0
  45. package/schema/vector-visual.schema.json +72 -0
  46. package/dist/binary.d.ts +0 -7
  47. package/dist/chunks/types-l6nBVYwx.js +0 -8
  48. package/dist/chunks/types-l6nBVYwx.js.map +0 -1
  49. package/dist/errors.d.ts +0 -7
  50. package/dist/extensions.d.ts +0 -19
  51. package/dist/index.js.map +0 -1
  52. package/dist/lottie-merge-path.d.ts +0 -11
  53. package/dist/lottie.js.map +0 -1
  54. package/dist/native3d/Animation3DError.d.ts +0 -8
  55. package/dist/native3d/Animation3DParser.d.ts +0 -7
  56. package/dist/native3d/Animation3DTypes.d.ts +0 -285
  57. package/dist/native3d/index.d.ts +0 -5
  58. package/dist/native3d.js.map +0 -1
  59. package/dist/parser.d.ts +0 -2
  60. package/dist/state-machine.d.ts +0 -130
  61. package/dist/text-selector.d.ts +0 -2
  62. package/dist/types.d.ts +0 -419
  63. package/dist/validation.d.ts +0 -32
  64. package/src/binary.ts +0 -1441
  65. package/src/errors.ts +0 -18
  66. package/src/extensions.ts +0 -55
  67. package/src/index.ts +0 -90
  68. package/src/lottie-merge-path.ts +0 -204
  69. package/src/lottie.ts +0 -3073
  70. package/src/native3d/Animation3DError.ts +0 -20
  71. package/src/native3d/Animation3DParser.ts +0 -964
  72. package/src/native3d/Animation3DTypes.ts +0 -322
  73. package/src/native3d/index.ts +0 -14
  74. package/src/native3d.ts +0 -2
  75. package/src/parser.ts +0 -41
  76. package/src/state-machine.ts +0 -645
  77. package/src/text-selector.ts +0 -7
  78. package/src/types.ts +0 -483
  79. package/src/validation.ts +0 -1286
  80. package/test/fixtures/basic-lottie.json +0 -31
package/package.json CHANGED
@@ -1,69 +1,93 @@
1
- {
2
- "name": "@haiyue/animation-spec",
3
- "version": "0.1.0",
4
- "private": false,
5
- "description": "Source-neutral HYA animation schemas, validation, binary codecs, and conversion adapters.",
6
- "license": "MIT",
7
- "repository": {
8
- "type": "git",
9
- "url": "git+https://github.com/HaiyueStudio/Engine.git",
10
- "directory": "animation-spec"
11
- },
12
- "type": "module",
13
- "main": "dist/index.js",
14
- "module": "dist/index.js",
15
- "types": "dist/index.d.ts",
16
- "sideEffects": false,
17
- "engines": {
18
- "node": ">=22"
19
- },
20
- "publishConfig": {
21
- "access": "public",
22
- "tag": "latest"
23
- },
24
- "files": [
25
- "dist",
26
- "bin",
27
- "schema",
28
- "LICENSE",
29
- "README.md",
30
- "SPECIFICATION.md",
31
- "test/fixtures/basic-lottie.json",
32
- "src/**/*"
33
- ],
34
- "bin": {
35
- "hya-convert": "./bin/hya-convert.mjs"
36
- },
37
- "exports": {
38
- ".": {
39
- "source": "./src/index.ts",
40
- "types": "./dist/index.d.ts",
41
- "import": "./dist/index.js"
42
- },
43
- "./lottie": {
44
- "source": "./src/lottie.ts",
45
- "types": "./dist/lottie.d.ts",
46
- "import": "./dist/lottie.js"
47
- },
48
- "./native3d": {
49
- "source": "./src/native3d.ts",
50
- "types": "./dist/native3d.d.ts",
51
- "import": "./dist/native3d.js"
52
- }
53
- },
54
- "scripts": {
55
- "build": "node ../scripts/build-rollup-once.mjs",
56
- "test": "node ../scripts/build-rollup-once.mjs && node --test --test-concurrency=1 \"test/**/*.test.mjs\"",
57
- "typecheck": "tsc -p tsconfig.json --noEmit",
58
- "samples:generate": "node ../scripts/build-rollup-once.mjs && node scripts/generate-samples.mjs",
59
- "corpus:sync": "node ../scripts/hya-corpus/sync.mjs"
60
- },
61
- "devDependencies": {
62
- "rollup": "^4.0.0",
63
- "tslib": "^2.6.0",
64
- "typescript": "^5.2.0"
65
- },
66
- "dependencies": {
67
- "polygon-clipping": "^0.15.7"
68
- }
69
- }
1
+ {
2
+ "name": "@haiyue/animation-spec",
3
+ "version": "0.2.2",
4
+ "private": false,
5
+ "description": "Source-neutral HYA animation schemas, validation, binary codecs, and conversion adapters.",
6
+ "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/HaiyueStudio/Engine.git",
10
+ "directory": "animation-spec"
11
+ },
12
+ "type": "module",
13
+ "main": "dist/index.js",
14
+ "module": "dist/index.js",
15
+ "types": "dist/index.d.ts",
16
+ "sideEffects": false,
17
+ "engines": {
18
+ "node": ">=22"
19
+ },
20
+ "publishConfig": {
21
+ "access": "public",
22
+ "tag": "latest"
23
+ },
24
+ "files": [
25
+ "dist",
26
+ "bin",
27
+ "schema",
28
+ "LICENSE",
29
+ "README.md",
30
+ "SPECIFICATION.md"
31
+ ],
32
+ "bin": {
33
+ "hya-convert": "./bin/hya-lottie-convert.mjs",
34
+ "hya-lottie-convert": "./bin/hya-lottie-convert.mjs",
35
+ "hya-live2d-convert": "./bin/hya-live2d-convert.mjs",
36
+ "hya-cubism-convert": "./bin/hya-live2d-convert.mjs"
37
+ },
38
+ "exports": {
39
+ ".": {
40
+ "types": "./dist/index.d.ts",
41
+ "import": "./dist/index.js"
42
+ },
43
+ "./lottie": {
44
+ "types": "./dist/lottie.d.ts",
45
+ "import": "./dist/lottie.js"
46
+ },
47
+ "./native3d": {
48
+ "types": "./dist/native3d.d.ts",
49
+ "import": "./dist/native3d.js"
50
+ },
51
+ "./deformable2d": {
52
+ "types": "./dist/deformable2d.d.ts",
53
+ "import": "./dist/deformable2d.js"
54
+ },
55
+ "./cubism": {
56
+ "types": "./dist/cubism.d.ts",
57
+ "import": "./dist/cubism.js"
58
+ },
59
+ "./live2d": {
60
+ "types": "./dist/live2d.d.ts",
61
+ "import": "./dist/live2d.js"
62
+ },
63
+ "./conversion": {
64
+ "types": "./dist/conversion.d.ts",
65
+ "import": "./dist/conversion.js"
66
+ },
67
+ "./live2d/clip-baked": {
68
+ "types": "./dist/live2d/clip-baked.d.ts",
69
+ "import": "./dist/live2d/clip-baked.js"
70
+ },
71
+ "./hya-production": {
72
+ "types": "./dist/hya-production.d.ts",
73
+ "import": "./dist/hya-production.js"
74
+ }
75
+ },
76
+ "scripts": {
77
+ "build": "node ../scripts/build-rollup-once.mjs && rollup -c rollup.dts.config.js && node ../scripts/install-bundled-declarations.mjs animation-spec dist-declarations",
78
+ "test": "npm run build && npm run build:conversion-tests && node --test --test-concurrency=1 \"test/**/*.test.mjs\"",
79
+ "build:conversion-tests": "node -e \"require('node:fs').rmSync('dist-test', { recursive: true, force: true })\" && tsc -p tsconfig.conversion-tests.json",
80
+ "typecheck": "tsc -p tsconfig.json --noEmit",
81
+ "samples:generate": "node ../scripts/build-rollup-once.mjs && node scripts/generate-samples.mjs",
82
+ "corpus:sync": "node ../scripts/hya-corpus/sync.mjs"
83
+ },
84
+ "devDependencies": {
85
+ "@rollup/plugin-node-resolve": "^15.3.1",
86
+ "rollup": "^4.0.0",
87
+ "tslib": "^2.6.0",
88
+ "typescript": "^5.2.0"
89
+ },
90
+ "dependencies": {
91
+ "polygon-clipping": "^0.15.7"
92
+ }
93
+ }
@@ -127,11 +127,80 @@
127
127
  "backgroundColor": { "$ref": "#/$defs/color" },
128
128
  "padding": { "type": "number", "minimum": 0 },
129
129
  "resolutionScale": { "type": "number", "exclusiveMinimum": 0, "maximum": 4 },
130
+ "expression": { "$ref": "#/$defs/safeExpression" },
130
131
  "documents": { "type": "array", "minItems": 1, "maxItems": 128, "items": { "$ref": "#/$defs/textDocument" } },
131
132
  "animators": { "type": "array", "minItems": 1, "maxItems": 16, "items": { "$ref": "#/$defs/textAnimator" } }
132
133
  },
133
134
  "additionalProperties": false
134
135
  },
136
+ "safeExpression": {
137
+ "type": "object",
138
+ "required": ["version", "result", "localCount", "instructions"],
139
+ "properties": {
140
+ "version": { "const": 1 },
141
+ "result": { "const": "text" },
142
+ "localCount": { "type": "integer", "minimum": 0, "maximum": 16 },
143
+ "instructions": {
144
+ "type": "array", "minItems": 1, "maxItems": 256,
145
+ "items": { "$ref": "#/$defs/safeExpressionInstruction" }
146
+ }
147
+ },
148
+ "additionalProperties": false
149
+ },
150
+ "safeExpressionInstruction": {
151
+ "oneOf": [
152
+ {
153
+ "type": "object", "required": ["op", "value"],
154
+ "properties": { "op": { "const": "constant" }, "value": { "type": ["number", "string", "boolean", "null"] } },
155
+ "additionalProperties": false
156
+ },
157
+ {
158
+ "type": "object", "required": ["op"],
159
+ "properties": { "op": { "enum": ["time", "text", "pop", "select", "return"] } },
160
+ "additionalProperties": false
161
+ },
162
+ {
163
+ "type": "object", "required": ["op", "resource", "path"],
164
+ "properties": {
165
+ "op": { "const": "data" }, "resource": { "type": "string", "minLength": 1 },
166
+ "path": { "type": "array", "minItems": 1, "maxItems": 32, "items": { "type": "string", "minLength": 1, "maxLength": 128 } }
167
+ },
168
+ "additionalProperties": false
169
+ },
170
+ {
171
+ "type": "object", "required": ["op", "index"],
172
+ "properties": { "op": { "enum": ["local.get", "local.set"] }, "index": { "type": "integer", "minimum": 0, "maximum": 15 } },
173
+ "additionalProperties": false
174
+ },
175
+ {
176
+ "type": "object", "required": ["op", "target"],
177
+ "properties": { "op": { "enum": ["branch.false", "jump"] }, "target": { "type": "integer", "minimum": 1, "maximum": 255 } },
178
+ "additionalProperties": false
179
+ },
180
+ {
181
+ "type": "object", "required": ["op", "operator"],
182
+ "properties": { "op": { "const": "unary" }, "operator": { "enum": ["positive", "negative", "not"] } },
183
+ "additionalProperties": false
184
+ },
185
+ {
186
+ "type": "object", "required": ["op", "operator"],
187
+ "properties": {
188
+ "op": { "const": "binary" },
189
+ "operator": { "enum": ["add", "subtract", "multiply", "divide", "remainder", "less", "less-equal", "greater", "greater-equal", "equal", "not-equal", "and", "or"] }
190
+ },
191
+ "additionalProperties": false
192
+ },
193
+ {
194
+ "type": "object", "required": ["op", "function", "argc"],
195
+ "properties": {
196
+ "op": { "const": "call" },
197
+ "function": { "enum": ["abs", "min", "max", "clamp", "floor", "ceil", "round", "sqrt", "pow", "sin", "cos", "tan", "asin", "acos", "atan", "atan2", "log", "exp", "lerp", "to-fixed"] },
198
+ "argc": { "type": "integer", "minimum": 1, "maximum": 3 }
199
+ },
200
+ "additionalProperties": false
201
+ }
202
+ ]
203
+ },
135
204
  "textDocument": {
136
205
  "type": "object", "required": ["time", "text"],
137
206
  "properties": {
@@ -153,8 +222,8 @@
153
222
  "easing": { "type": "array", "items": { "type": "number", "minimum": 0, "maximum": 1 }, "minItems": 4, "maxItems": 4 },
154
223
  "smoothness": { "type": "number", "minimum": 0, "maximum": 1 },
155
224
  "randomSeed": { "type": "integer", "minimum": 0, "maximum": 4294967295 },
156
- "startTrack": { "$ref": "#/$defs/vectorTrack" }, "endTrack": { "$ref": "#/$defs/vectorTrack" },
157
- "offsetTrack": { "$ref": "#/$defs/vectorTrack" }, "amountTrack": { "$ref": "#/$defs/vectorTrack" }
225
+ "startTrack": { "$ref": "#/$defs/vectorValueTrack" }, "endTrack": { "$ref": "#/$defs/vectorValueTrack" },
226
+ "offsetTrack": { "$ref": "#/$defs/vectorValueTrack" }, "amountTrack": { "$ref": "#/$defs/vectorValueTrack" }
158
227
  }, "additionalProperties": false
159
228
  },
160
229
  "textAnimator": {
@@ -163,9 +232,9 @@
163
232
  "selector": { "$ref": "#/$defs/textSelector" }, "position": { "$ref": "#/$defs/vec2" }, "scale": { "$ref": "#/$defs/vec2" },
164
233
  "rotation": { "type": "number" }, "opacity": { "type": "number", "minimum": 0, "maximum": 1 },
165
234
  "fillColor": { "$ref": "#/$defs/color" }, "tracking": { "type": "number" },
166
- "positionTrack": { "$ref": "#/$defs/vectorTrack" }, "scaleTrack": { "$ref": "#/$defs/vectorTrack" },
167
- "rotationTrack": { "$ref": "#/$defs/vectorTrack" }, "opacityTrack": { "$ref": "#/$defs/vectorTrack" },
168
- "fillColorTrack": { "$ref": "#/$defs/vectorTrack" }, "trackingTrack": { "$ref": "#/$defs/vectorTrack" }
235
+ "positionTrack": { "$ref": "#/$defs/vectorValueTrack" }, "scaleTrack": { "$ref": "#/$defs/vectorValueTrack" },
236
+ "rotationTrack": { "$ref": "#/$defs/vectorValueTrack" }, "opacityTrack": { "$ref": "#/$defs/vectorValueTrack" },
237
+ "fillColorTrack": { "$ref": "#/$defs/vectorValueTrack" }, "trackingTrack": { "$ref": "#/$defs/vectorValueTrack" }
169
238
  }, "additionalProperties": false
170
239
  },
171
240
  "particle2d": {
@@ -336,6 +405,8 @@
336
405
  ]
337
406
  },
338
407
  "stroke": { "$ref": "#/$defs/vectorStroke" },
408
+ "feather": { "$ref": "#/$defs/vectorFeather" },
409
+ "innerFeather": { "$ref": "#/$defs/vectorInnerFeather" },
339
410
  "modifiers": {
340
411
  "type": "array",
341
412
  "minItems": 1,
@@ -346,6 +417,27 @@
346
417
  "tolerance": { "type": "number", "exclusiveMinimum": 0 }
347
418
  },
348
419
  "anyOf": [{ "required": ["fill"] }, { "required": ["stroke"] }],
420
+ "not": { "required": ["feather", "innerFeather"] },
421
+ "additionalProperties": false
422
+ },
423
+ "vectorFeather": {
424
+ "type": "object",
425
+ "required": ["radius", "inner"],
426
+ "properties": {
427
+ "radius": { "type": "array", "minItems": 2, "maxItems": 2, "items": { "type": "number", "minimum": 0, "maximum": 4096 } },
428
+ "offset": { "$ref": "#/$defs/vec2" },
429
+ "inner": { "type": "boolean" },
430
+ "space": { "enum": ["local", "world"] }
431
+ },
432
+ "additionalProperties": false
433
+ },
434
+ "vectorInnerFeather": {
435
+ "type": "object",
436
+ "required": ["radius"],
437
+ "properties": {
438
+ "radius": { "$ref": "#/$defs/nonNegativeVec2" },
439
+ "offset": { "$ref": "#/$defs/vec2" }
440
+ },
349
441
  "additionalProperties": false
350
442
  },
351
443
  "vectorPathModifier": {
@@ -396,31 +488,31 @@
396
488
  "black": { "type": "array", "minItems": 3, "maxItems": 3, "items": { "type": "number", "minimum": 0, "maximum": 1 } },
397
489
  "white": { "type": "array", "minItems": 3, "maxItems": 3, "items": { "type": "number", "minimum": 0, "maximum": 1 } },
398
490
  "amount": { "type": "number", "minimum": 0, "maximum": 1 },
399
- "blackTrack": { "$ref": "#/$defs/vectorTrack" }, "whiteTrack": { "$ref": "#/$defs/vectorTrack" }, "amountTrack": { "$ref": "#/$defs/vectorTrack" }
491
+ "blackTrack": { "$ref": "#/$defs/vectorValueTrack" }, "whiteTrack": { "$ref": "#/$defs/vectorValueTrack" }, "amountTrack": { "$ref": "#/$defs/vectorValueTrack" }
400
492
  }, "additionalProperties": false
401
493
  },
402
494
  {
403
495
  "type": "object", "required": ["kind", "color"],
404
496
  "properties": {
405
497
  "kind": { "const": "fill" }, "color": { "$ref": "#/$defs/color" }, "opacity": { "type": "number", "minimum": 0, "maximum": 1 },
406
- "colorTrack": { "$ref": "#/$defs/vectorTrack" }, "opacityTrack": { "$ref": "#/$defs/vectorTrack" }
498
+ "colorTrack": { "$ref": "#/$defs/vectorValueTrack" }, "opacityTrack": { "$ref": "#/$defs/vectorValueTrack" }
407
499
  }, "additionalProperties": false
408
500
  },
409
501
  {
410
502
  "type": "object", "required": ["kind", "opacity"],
411
- "properties": { "kind": { "const": "opacity" }, "opacity": { "type": "number", "minimum": 0, "maximum": 1 }, "opacityTrack": { "$ref": "#/$defs/vectorTrack" } },
503
+ "properties": { "kind": { "const": "opacity" }, "opacity": { "type": "number", "minimum": 0, "maximum": 1 }, "opacityTrack": { "$ref": "#/$defs/vectorValueTrack" } },
412
504
  "additionalProperties": false
413
505
  },
414
506
  {
415
507
  "type": "object", "required": ["kind", "matrix"],
416
508
  "properties": {
417
509
  "kind": { "const": "color-matrix" }, "matrix": { "type": "array", "minItems": 20, "maxItems": 20, "items": { "type": "number" } },
418
- "matrixTrack": { "$ref": "#/$defs/vectorTrack" }
510
+ "matrixTrack": { "$ref": "#/$defs/vectorValueTrack" }
419
511
  }, "additionalProperties": false
420
512
  },
421
513
  {
422
514
  "type": "object", "required": ["kind", "radius"],
423
- "properties": { "kind": { "const": "blur" }, "radius": { "$ref": "#/$defs/nonNegativeVec2" }, "radiusTrack": { "$ref": "#/$defs/vectorTrack" } },
515
+ "properties": { "kind": { "const": "blur" }, "radius": { "$ref": "#/$defs/nonNegativeVec2" }, "radiusTrack": { "$ref": "#/$defs/vectorValueTrack" } },
424
516
  "additionalProperties": false
425
517
  },
426
518
  {
@@ -428,8 +520,8 @@
428
520
  "properties": {
429
521
  "kind": { "const": "drop-shadow" }, "color": { "$ref": "#/$defs/color" }, "opacity": { "type": "number", "minimum": 0, "maximum": 1 },
430
522
  "offset": { "$ref": "#/$defs/vec2" }, "blur": { "type": "number", "minimum": 0 },
431
- "colorTrack": { "$ref": "#/$defs/vectorTrack" }, "opacityTrack": { "$ref": "#/$defs/vectorTrack" },
432
- "offsetTrack": { "$ref": "#/$defs/vectorTrack" }, "blurTrack": { "$ref": "#/$defs/vectorTrack" }
523
+ "colorTrack": { "$ref": "#/$defs/vectorValueTrack" }, "opacityTrack": { "$ref": "#/$defs/vectorValueTrack" },
524
+ "offsetTrack": { "$ref": "#/$defs/vectorValueTrack" }, "blurTrack": { "$ref": "#/$defs/vectorValueTrack" }
433
525
  }, "additionalProperties": false
434
526
  }
435
527
  ]
@@ -0,0 +1,18 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://haiyue.dev/schemas/animation/deformable-mesh-2d-extension.schema.json",
4
+ "title": "HYA deformable mesh 2D component v1",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["type", "dataResource", "textures"],
8
+ "properties": {
9
+ "type": { "const": "org.haiyue.deformable-mesh-2d@1" },
10
+ "dataResource": { "type": "string", "minLength": 1, "maxLength": 256 },
11
+ "textures": {
12
+ "type": "array",
13
+ "minItems": 1,
14
+ "maxItems": 32,
15
+ "items": { "type": "string", "minLength": 1, "maxLength": 256 }
16
+ }
17
+ }
18
+ }
@@ -0,0 +1,58 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "format": "haiyue-deformable-mesh-2d-contract",
4
+ "version": 1,
5
+ "extension": {
6
+ "id": "org.haiyue.deformable-mesh-2d@1",
7
+ "required": true,
8
+ "dataFormat": "haiyue-deformable-mesh-2d",
9
+ "dataVersion": 1,
10
+ "mediaType": "application/vnd.haiyue.deformable-mesh-2d",
11
+ "binaryMagic": "HYDM",
12
+ "binaryVersion": "1.2",
13
+ "compatibleBinaryVersions": ["1.0", "1.1", "1.2"],
14
+ "headerBytes": 32
15
+ },
16
+ "profile": {
17
+ "id": "clip-baked",
18
+ "coordinates": "screen-y-down",
19
+ "positions": "absolute-frame-major-float32",
20
+ "opacitySampling": "linear",
21
+ "positionSampling": "linear",
22
+ "multiplyColorSampling": "linear-frame-major-rgba",
23
+ "screenColorSampling": "linear-frame-major-rgba",
24
+ "drawableColorNeutralRgb": {
25
+ "multiply": [1, 1, 1],
26
+ "screen": [0, 0, 0]
27
+ },
28
+ "drawableColorAlphaUsage": "preserved-not-rendered",
29
+ "renderOrderSampling": "step"
30
+ },
31
+ "limits": {
32
+ "maxInputBytes": 67108864,
33
+ "maxMetadataBytes": 4194304,
34
+ "maxDrawables": 4096,
35
+ "maxVertices": 2000000,
36
+ "maxFrames": 36000,
37
+ "maxMaskReferences": 32768,
38
+ "maxTextures": 32
39
+ },
40
+ "runtime": {
41
+ "ownerPackage": "@haiyue/extensions/deformable-animation",
42
+ "sourceRuntimeDependency": false,
43
+ "supportedBlendModes": ["normal", "additive", "multiplicative"],
44
+ "supportedMasks": ["alpha", "alpha-inverted"],
45
+ "sampledDrawableColors": ["multiply", "screen"],
46
+ "renderedDrawableColors": [],
47
+ "renderedDrawableColorsGoal": "m05-g15-drawable-color-runtime-parity"
48
+ },
49
+ "diagnostics": [
50
+ "E_ANIMATION_INVALID_FORMAT",
51
+ "E_ANIMATION_LIMIT_EXCEEDED",
52
+ "E_CUBISM_CAPTURE_INVALID",
53
+ "E_CUBISM_TOPOLOGY_CHANGED",
54
+ "E_CUBISM_DRAWABLE_COLOR_INVALID",
55
+ "W_CUBISM_DRAWABLE_COLOR_UNAVAILABLE",
56
+ "W_CUBISM_CULLING_IGNORED"
57
+ ]
58
+ }
@@ -0,0 +1,41 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://haiyue.dev/schema/hya-composition-v1.json",
4
+ "title": "HYA composition envelope v1",
5
+ "description": "Editor shape aid. The source-neutral parser is normative for JSON safety, aggregate budgets, existing part formats, typed target addresses, dependencies and capability negotiation.",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "required": ["format", "version", "parts", "targets"],
9
+ "properties": {
10
+ "format": {"const": "haiyue-composition"},
11
+ "version": {"const": 1},
12
+ "parts": {"type": "array", "maxItems": 16, "items": {"$ref": "#/$defs/part"}},
13
+ "targets": {"type": "array", "maxItems": 100000, "items": {"$ref": "#/$defs/target"}}
14
+ },
15
+ "$defs": {
16
+ "id": {"type": "string", "minLength": 1, "maxLength": 256, "pattern": "^[^\\u0000-\\u001f]+$"},
17
+ "extension": {"type": "string", "maxLength": 256, "pattern": "^[a-zA-Z0-9]+(?:[.-][a-zA-Z0-9]+)+@[1-9][0-9]*$"},
18
+ "part": {
19
+ "type": "object", "additionalProperties": false,
20
+ "required": ["id", "extension", "required", "requires", "dependencies", "document"],
21
+ "properties": {
22
+ "id": {"$ref": "#/$defs/id"},
23
+ "extension": {"$ref": "#/$defs/extension"},
24
+ "required": {"type": "boolean"},
25
+ "requires": {"type": "array", "maxItems": 64, "uniqueItems": true, "items": {"$ref": "#/$defs/extension"}},
26
+ "dependencies": {"type": "array", "maxItems": 16, "uniqueItems": true, "items": {"$ref": "#/$defs/id"}},
27
+ "document": {}
28
+ }
29
+ },
30
+ "target": {
31
+ "type": "object", "additionalProperties": false,
32
+ "required": ["id", "part", "kind", "address"],
33
+ "properties": {
34
+ "id": {"$ref": "#/$defs/id"},
35
+ "part": {"$ref": "#/$defs/id"},
36
+ "kind": {"enum": ["animation-node", "layout-node", "text-block", "asset", "state-input", "interaction-target", "semantic-node", "audio-cue"]},
37
+ "address": {"type": "array", "minItems": 1, "maxItems": 2, "items": {"$ref": "#/$defs/id"}}
38
+ }
39
+ }
40
+ }
41
+ }
@@ -0,0 +1,63 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "format": "haiyue-parameterized-rig-2d-contract",
4
+ "version": 2,
5
+ "extension": "org.haiyue.deformable-mesh-2d@2",
6
+ "sourceNeutral": true,
7
+ "sourceRuntimeDependency": false,
8
+ "compatibleLegacyExtension": "org.haiyue.deformable-mesh-2d@1",
9
+ "legacySemanticsChanged": false,
10
+ "coordinates": "screen-y-down",
11
+ "evaluation": {
12
+ "canonicalStatePerCall": true,
13
+ "constraintOrder": "order-then-id",
14
+ "parameterMix": "normalized-override-then-additive",
15
+ "skinning": "world-bone-times-inverse-bind",
16
+ "variableInfluenceCount": true,
17
+ "closedPathDistance": "positive-modulo-total-length",
18
+ "followPathDistanceEnd": "optional-span-end-controls-orientation",
19
+ "translationLimitSpace": "convert-source-to-limit-space-clamp-then-convert-to-destination",
20
+ "drawablePaintOutput": ["texture", "opacity", "blendMode", "culling", "multiplyColor", "screenColor", "masks", "maskMode", "visibility", "drawOrder"],
21
+ "interactiveStateBakedToClips": false
22
+ },
23
+ "compilerLowering": {
24
+ "cubicWeights": "normalize control-handle influences into the standard variable-count CSR skinning arrays",
25
+ "listFollowPath": "lower each evaluated list span to distance plus distanceEnd without retaining source runtime objects"
26
+ },
27
+ "binary": {
28
+ "magic": "HYRG",
29
+ "major": 2,
30
+ "minor": 0,
31
+ "endianness": "little",
32
+ "headerBytes": 40,
33
+ "header": ["magic:u32", "major:u16", "minor:u16", "metadataOffset:u32", "metadataBytes:u32", "floatOffset:u32", "floatCount:u32", "indexOffset:u32", "indexCount:u32", "totalBytes:u32", "flags:u32"],
34
+ "metadata": "utf8-json",
35
+ "floatPool": "contiguous-float32",
36
+ "indexPool": "contiguous-uint32",
37
+ "poolRanges": "canonical-no-alias-no-gap",
38
+ "alignment": 4
39
+ },
40
+ "limits": {
41
+ "maxInputBytes": 67108864,
42
+ "maxMetadataBytes": 4194304,
43
+ "maxRigs": 1024,
44
+ "maxInstances": 8192,
45
+ "maxBones": 65536,
46
+ "maxMeshes": 16384,
47
+ "maxDrawables": 1000000,
48
+ "maxVertices": 5000000,
49
+ "maxIndices": 15000000,
50
+ "maxInfluences": 40000000,
51
+ "maxInfluencesPerVertex": 32,
52
+ "maxConstraints": 250000,
53
+ "maxConstraintIterations": 128,
54
+ "maxPaths": 65536,
55
+ "maxPathPoints": 5000000,
56
+ "maxParameters": 250000,
57
+ "maxDrivers": 1000000,
58
+ "maxNestingDepth": 128,
59
+ "maxGpuBytes": 536870912
60
+ },
61
+ "diagnostics": ["E_RIG_FORMAT", "E_RIG_LIMIT", "E_RIG_NUMBER", "E_RIG_REFERENCE", "E_RIG_CYCLE", "E_RIG_WEIGHT", "E_RIG_DEGENERATE", "E_RIG_NON_CONVERGENCE", "E_RIG_BINARY"],
62
+ "integration": { "publicExportOwner": "G13", "importAdapterOwner": "G10", "formalOracleOwner": "G11" }
63
+ }
@@ -0,0 +1,57 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://haiyue.dev/schemas/animation/parameterized-rig-2d.schema.json",
4
+ "title": "Source-neutral HYA parameterized deformable rig 2D v2",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["format", "version", "extension", "width", "height", "parameters", "rigs", "instances"],
8
+ "properties": {
9
+ "format": { "const": "haiyue-parameterized-rig-2d" },
10
+ "version": { "const": 2 },
11
+ "extension": { "const": "org.haiyue.deformable-mesh-2d@2" },
12
+ "width": { "$ref": "#/$defs/positive" },
13
+ "height": { "$ref": "#/$defs/positive" },
14
+ "duration": { "$ref": "#/$defs/nonNegative" },
15
+ "parameters": { "type": "array", "maxItems": 250000, "items": { "$ref": "#/$defs/parameter" } },
16
+ "rigs": { "type": "array", "maxItems": 1024, "items": { "$ref": "#/$defs/rig" } },
17
+ "instances": { "type": "array", "maxItems": 8192, "items": { "$ref": "#/$defs/instance" } }
18
+ },
19
+ "$defs": {
20
+ "finite": { "type": "number" },
21
+ "positive": { "type": "number", "exclusiveMinimum": 0 },
22
+ "nonNegative": { "type": "number", "minimum": 0 },
23
+ "id": { "type": "string", "minLength": 1, "maxLength": 256 },
24
+ "vec2": { "type": "array", "minItems": 2, "maxItems": 2, "items": { "$ref": "#/$defs/finite" } },
25
+ "color": { "type": "array", "minItems": 4, "maxItems": 4, "items": { "type": "number", "minimum": 0, "maximum": 1 } },
26
+ "transform": { "type": "object", "additionalProperties": false, "required": ["x", "y", "rotation", "scaleX", "scaleY"], "properties": { "x": { "$ref": "#/$defs/finite" }, "y": { "$ref": "#/$defs/finite" }, "rotation": { "$ref": "#/$defs/finite" }, "scaleX": { "$ref": "#/$defs/finite" }, "scaleY": { "$ref": "#/$defs/finite" }, "skew": { "$ref": "#/$defs/finite" } } },
27
+ "parameter": { "type": "object", "additionalProperties": false, "required": ["id", "default", "min", "max"], "properties": { "id": { "$ref": "#/$defs/id" }, "default": { "$ref": "#/$defs/finite" }, "min": { "$ref": "#/$defs/finite" }, "max": { "$ref": "#/$defs/finite" } } },
28
+ "bone": { "type": "object", "additionalProperties": false, "required": ["id", "length", "bind", "inverseBind"], "properties": { "id": { "$ref": "#/$defs/id" }, "parent": { "$ref": "#/$defs/id" }, "length": { "$ref": "#/$defs/nonNegative" }, "bind": { "$ref": "#/$defs/transform" }, "inverseBind": { "type": "array", "minItems": 6, "maxItems": 6, "items": { "$ref": "#/$defs/finite" } } } },
29
+ "mesh": { "type": "object", "additionalProperties": false, "required": ["id", "positions", "uvs", "indices", "influenceOffsets", "jointIndices", "weights"], "properties": { "id": { "$ref": "#/$defs/id" }, "positions": { "type": "array", "maxItems": 10000000, "items": { "$ref": "#/$defs/finite" } }, "uvs": { "type": "array", "maxItems": 10000000, "items": { "$ref": "#/$defs/finite" } }, "indices": { "type": "array", "maxItems": 15000000, "items": { "type": "integer", "minimum": 0 } }, "influenceOffsets": { "type": "array", "maxItems": 5000001, "items": { "type": "integer", "minimum": 0 } }, "jointIndices": { "type": "array", "maxItems": 40000000, "items": { "type": "integer", "minimum": 0 } }, "weights": { "type": "array", "maxItems": 40000000, "items": { "$ref": "#/$defs/nonNegative" } } } },
30
+ "drawable": { "type": "object", "additionalProperties": false, "required": ["id", "mesh", "drawOrder"], "properties": { "id": { "$ref": "#/$defs/id" }, "mesh": { "$ref": "#/$defs/id" }, "texture": { "$ref": "#/$defs/id" }, "visible": { "type": "boolean" }, "solo": { "type": "boolean" }, "drawOrder": { "$ref": "#/$defs/finite" }, "opacity": { "type": "number", "minimum": 0, "maximum": 1 }, "blendMode": { "enum": ["normal", "additive", "multiplicative"] }, "culling": { "type": "boolean" }, "multiplyColor": { "$ref": "#/$defs/color" }, "screenColor": { "$ref": "#/$defs/color" }, "masks": { "type": "array", "items": { "$ref": "#/$defs/id" } }, "maskMode": { "enum": ["alpha", "alpha-inverted"] } } },
31
+ "path": { "type": "object", "additionalProperties": false, "required": ["id", "points"], "properties": { "id": { "$ref": "#/$defs/id" }, "points": { "type": "array", "minItems": 4, "maxItems": 10000000, "items": { "$ref": "#/$defs/finite" } }, "closed": { "type": "boolean" } } },
32
+ "physics": { "type": "object", "additionalProperties": false, "required": ["kind", "friction", "speedMultiplier"], "properties": { "kind": { "enum": ["clamped", "elastic"] }, "friction": { "$ref": "#/$defs/nonNegative" }, "speedMultiplier": { "$ref": "#/$defs/nonNegative" }, "elasticFactor": { "$ref": "#/$defs/nonNegative" }, "threshold": { "$ref": "#/$defs/nonNegative" } } },
33
+ "constraint": {
34
+ "type": "object",
35
+ "additionalProperties": false,
36
+ "required": ["id", "kind", "order", "strength", "constrained"],
37
+ "properties": {
38
+ "id": { "$ref": "#/$defs/id" }, "kind": { "enum": ["ik", "distance", "transform", "translation", "scale", "rotation", "follow-path", "scroll", "scrollbar"] }, "order": { "$ref": "#/$defs/finite" }, "enabled": { "type": "boolean" }, "strength": { "type": "number", "minimum": 0, "maximum": 1 }, "constrained": { "$ref": "#/$defs/id" }, "sourceSpace": { "enum": ["local", "world"] }, "destinationSpace": { "enum": ["local", "world"] },
39
+ "target": { "$ref": "#/$defs/id" }, "chainLength": { "type": "integer", "minimum": 1 }, "invertDirection": { "type": "boolean" }, "iterations": { "type": "integer", "minimum": 1, "maximum": 128 }, "tolerance": { "$ref": "#/$defs/positive" }, "nonConvergence": { "enum": ["error", "clamp"] }, "distance": { "$ref": "#/$defs/finite" }, "distanceEnd": { "$ref": "#/$defs/finite" }, "mode": { "enum": ["exact", "minimum", "maximum"] }, "copyFactor": { "$ref": "#/$defs/finite" }, "copyFactorY": { "$ref": "#/$defs/finite" }, "offset": { "anyOf": [{ "$ref": "#/$defs/finite" }, { "$ref": "#/$defs/transform" }] }, "min": { "anyOf": [{ "$ref": "#/$defs/finite" }, { "$ref": "#/$defs/transform" }] }, "max": { "anyOf": [{ "$ref": "#/$defs/finite" }, { "$ref": "#/$defs/transform" }] }, "offsetX": { "$ref": "#/$defs/finite" }, "offsetY": { "$ref": "#/$defs/finite" }, "minX": { "$ref": "#/$defs/finite" }, "maxX": { "$ref": "#/$defs/finite" }, "minY": { "$ref": "#/$defs/finite" }, "maxY": { "$ref": "#/$defs/finite" }, "limitSpace": { "enum": ["local", "world"] }, "path": { "$ref": "#/$defs/id" }, "orient": { "type": "boolean" },
40
+ "axis": { "enum": ["x", "y", "both"] }, "offsetParameterX": { "$ref": "#/$defs/id" }, "offsetParameterY": { "$ref": "#/$defs/id" }, "percentParameterX": { "$ref": "#/$defs/id" }, "percentParameterY": { "$ref": "#/$defs/id" }, "indexParameter": { "$ref": "#/$defs/id" }, "velocityParameterX": { "$ref": "#/$defs/id" }, "velocityParameterY": { "$ref": "#/$defs/id" }, "activeParameter": { "$ref": "#/$defs/id" }, "viewport": { "$ref": "#/$defs/vec2" }, "content": { "$ref": "#/$defs/vec2" }, "infinite": { "type": "boolean" }, "virtualize": { "type": "boolean" }, "virtualizeBuffer": { "$ref": "#/$defs/nonNegative" }, "interactive": { "type": "boolean" }, "threshold": { "$ref": "#/$defs/nonNegative" }, "dragMultiplier": { "$ref": "#/$defs/nonNegative" }, "snap": { "$ref": "#/$defs/positive" }, "physics": { "$ref": "#/$defs/physics" }, "scrollConstraint": { "$ref": "#/$defs/id" }, "autoSize": { "type": "boolean" }
41
+ },
42
+ "allOf": [
43
+ { "if": { "properties": { "kind": { "const": "ik" } } }, "then": { "required": ["target", "chainLength"] } },
44
+ { "if": { "properties": { "kind": { "const": "distance" } } }, "then": { "required": ["target", "distance"] } },
45
+ { "if": { "properties": { "kind": { "enum": ["transform", "translation", "scale", "rotation"] } } }, "then": { "required": ["target"] } },
46
+ { "if": { "properties": { "kind": { "const": "follow-path" } } }, "then": { "required": ["path", "distance"] } },
47
+ { "if": { "properties": { "kind": { "const": "scroll" } } }, "then": { "required": ["axis", "viewport", "content"] } },
48
+ { "if": { "properties": { "kind": { "const": "scrollbar" } } }, "then": { "required": ["scrollConstraint"] } }
49
+ ]
50
+ },
51
+ "driverTarget": { "type": "object", "additionalProperties": false, "required": ["kind", "id", "property"], "properties": { "kind": { "enum": ["bone", "constraint", "drawable"] }, "id": { "$ref": "#/$defs/id" }, "property": { "enum": ["x", "y", "rotation", "scaleX", "scaleY", "skew", "strength", "distance", "offset", "opacity", "drawOrder", "visibility"] } } },
52
+ "driver": { "type": "object", "additionalProperties": false, "required": ["id", "parameter", "input", "output", "target"], "properties": { "id": { "$ref": "#/$defs/id" }, "parameter": { "$ref": "#/$defs/id" }, "input": { "$ref": "#/$defs/vec2" }, "output": { "$ref": "#/$defs/vec2" }, "clamp": { "type": "boolean" }, "mode": { "enum": ["replace", "add"] }, "target": { "$ref": "#/$defs/driverTarget" } } },
53
+ "joystick": { "type": "object", "additionalProperties": false, "required": ["id", "center", "size"], "properties": { "id": { "$ref": "#/$defs/id" }, "xParameter": { "$ref": "#/$defs/id" }, "yParameter": { "$ref": "#/$defs/id" }, "center": { "$ref": "#/$defs/vec2" }, "size": { "$ref": "#/$defs/vec2" }, "origin": { "$ref": "#/$defs/vec2" }, "handleDrawable": { "$ref": "#/$defs/id" }, "invertX": { "type": "boolean" }, "invertY": { "type": "boolean" } } },
54
+ "rig": { "type": "object", "additionalProperties": false, "required": ["id", "bones", "meshes", "drawables"], "properties": { "id": { "$ref": "#/$defs/id" }, "bones": { "type": "array", "items": { "$ref": "#/$defs/bone" } }, "meshes": { "type": "array", "items": { "$ref": "#/$defs/mesh" } }, "drawables": { "type": "array", "items": { "$ref": "#/$defs/drawable" } }, "constraints": { "type": "array", "items": { "$ref": "#/$defs/constraint" } }, "paths": { "type": "array", "items": { "$ref": "#/$defs/path" } }, "drivers": { "type": "array", "items": { "$ref": "#/$defs/driver" } }, "joysticks": { "type": "array", "items": { "$ref": "#/$defs/joystick" } } } },
55
+ "instance": { "type": "object", "additionalProperties": false, "required": ["id", "rig"], "properties": { "id": { "$ref": "#/$defs/id" }, "rig": { "$ref": "#/$defs/id" }, "parentInstance": { "$ref": "#/$defs/id" }, "parentBone": { "$ref": "#/$defs/id" }, "transform": { "$ref": "#/$defs/transform" }, "parameterMap": { "type": "object", "additionalProperties": { "$ref": "#/$defs/id" } } } }
56
+ }
57
+ }