@haiyue/animation-spec 0.1.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.
Files changed (52) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +190 -0
  3. package/SPECIFICATION.md +108 -0
  4. package/bin/hya-convert.mjs +31 -0
  5. package/dist/binary.d.ts +7 -0
  6. package/dist/chunks/types-l6nBVYwx.js +8 -0
  7. package/dist/chunks/types-l6nBVYwx.js.map +1 -0
  8. package/dist/errors.d.ts +7 -0
  9. package/dist/extensions.d.ts +19 -0
  10. package/dist/index.d.ts +10 -0
  11. package/dist/index.js +2927 -0
  12. package/dist/index.js.map +1 -0
  13. package/dist/lottie-merge-path.d.ts +11 -0
  14. package/dist/lottie.d.ts +62 -0
  15. package/dist/lottie.js +2642 -0
  16. package/dist/lottie.js.map +1 -0
  17. package/dist/native3d/Animation3DError.d.ts +8 -0
  18. package/dist/native3d/Animation3DParser.d.ts +7 -0
  19. package/dist/native3d/Animation3DTypes.d.ts +285 -0
  20. package/dist/native3d/index.d.ts +5 -0
  21. package/dist/native3d.d.ts +2 -0
  22. package/dist/native3d.js +907 -0
  23. package/dist/native3d.js.map +1 -0
  24. package/dist/parser.d.ts +2 -0
  25. package/dist/state-machine.d.ts +130 -0
  26. package/dist/text-selector.d.ts +2 -0
  27. package/dist/types.d.ts +419 -0
  28. package/dist/validation.d.ts +32 -0
  29. package/package.json +69 -0
  30. package/schema/animation-3d-carrier.schema.json +73 -0
  31. package/schema/animation-3d-extension.schema.json +573 -0
  32. package/schema/animation-3d.contract.json +130 -0
  33. package/schema/animation.schema.json +611 -0
  34. package/schema/fixtures/native-3d-mixed-invalid.hya.json +50 -0
  35. package/schema/fixtures/native-3d-valid.hya.json +284 -0
  36. package/src/binary.ts +1441 -0
  37. package/src/errors.ts +18 -0
  38. package/src/extensions.ts +55 -0
  39. package/src/index.ts +90 -0
  40. package/src/lottie-merge-path.ts +204 -0
  41. package/src/lottie.ts +3073 -0
  42. package/src/native3d/Animation3DError.ts +20 -0
  43. package/src/native3d/Animation3DParser.ts +964 -0
  44. package/src/native3d/Animation3DTypes.ts +322 -0
  45. package/src/native3d/index.ts +14 -0
  46. package/src/native3d.ts +2 -0
  47. package/src/parser.ts +41 -0
  48. package/src/state-machine.ts +645 -0
  49. package/src/text-selector.ts +7 -0
  50. package/src/types.ts +483 -0
  51. package/src/validation.ts +1286 -0
  52. package/test/fixtures/basic-lottie.json +31 -0
@@ -0,0 +1,611 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://haiyue.dev/schema/animation/1.0.json",
4
+ "title": "Haiyue Animation 1.0 authoring document",
5
+ "type": "object",
6
+ "required": ["format", "version", "canvas", "duration", "nodes"],
7
+ "properties": {
8
+ "format": { "const": "haiyue-animation" },
9
+ "version": { "const": "1.0" },
10
+ "name": { "type": "string" },
11
+ "canvas": {
12
+ "type": "object",
13
+ "required": ["width", "height", "coordinateSystem"],
14
+ "properties": {
15
+ "width": { "type": "number", "exclusiveMinimum": 0 },
16
+ "height": { "type": "number", "exclusiveMinimum": 0 },
17
+ "coordinateSystem": { "const": "screen-y-down" }
18
+ },
19
+ "additionalProperties": false
20
+ },
21
+ "duration": { "type": "number", "exclusiveMinimum": 0 },
22
+ "frameRate": { "type": "number", "exclusiveMinimum": 0 },
23
+ "endBehavior": { "enum": ["hold", "loop", "destroy"] },
24
+ "resources": { "type": "array", "items": { "$ref": "#/$defs/resource" } },
25
+ "nodes": { "type": "array", "items": { "$ref": "#/$defs/node" } },
26
+ "tracks": { "type": "array", "items": { "$ref": "#/$defs/track" } },
27
+ "extensionsUsed": { "type": "array", "uniqueItems": true, "items": { "$ref": "#/$defs/extensionId" } },
28
+ "extensionsRequired": { "type": "array", "uniqueItems": true, "items": { "$ref": "#/$defs/extensionId" } },
29
+ "extensions": {
30
+ "type": "object",
31
+ "properties": {
32
+ "org.haiyue.animation-state-machine@1": { "$ref": "#/$defs/hyaStateMachineExtension" }
33
+ },
34
+ "additionalProperties": true
35
+ }
36
+ },
37
+ "additionalProperties": false,
38
+ "$defs": {
39
+ "vec2": { "type": "array", "prefixItems": [{ "type": "number" }, { "type": "number" }], "minItems": 2, "maxItems": 2 },
40
+ "positiveVec2": { "type": "array", "prefixItems": [{ "type": "number", "exclusiveMinimum": 0 }, { "type": "number", "exclusiveMinimum": 0 }], "minItems": 2, "maxItems": 2 },
41
+ "nonNegativeVec2": { "type": "array", "prefixItems": [{ "type": "number", "minimum": 0 }, { "type": "number", "minimum": 0 }], "minItems": 2, "maxItems": 2 },
42
+ "color": { "type": "array", "items": { "type": "number", "minimum": 0, "maximum": 1 }, "minItems": 4, "maxItems": 4 },
43
+ "extensionId": { "type": "string", "pattern": "^[A-Za-z0-9]+(?:[.-][A-Za-z0-9]+)+@[1-9][0-9]*$" },
44
+ "resource": {
45
+ "type": "object",
46
+ "required": ["id", "type", "uri"],
47
+ "properties": {
48
+ "id": { "type": "string", "minLength": 1 },
49
+ "type": { "enum": ["image", "audio", "binary"] },
50
+ "uri": { "type": "string", "minLength": 1 },
51
+ "width": { "type": "number", "exclusiveMinimum": 0 },
52
+ "height": { "type": "number", "exclusiveMinimum": 0 },
53
+ "mimeType": { "type": "string", "minLength": 1 },
54
+ "integrity": { "type": "string", "minLength": 1 },
55
+ "colorSpace": { "enum": ["srgb", "linear"] }
56
+ },
57
+ "additionalProperties": false
58
+ },
59
+ "transform": {
60
+ "type": "object",
61
+ "properties": {
62
+ "position": { "$ref": "#/$defs/vec2" },
63
+ "rotation": { "type": "number" },
64
+ "scale": { "$ref": "#/$defs/vec2" },
65
+ "anchor": { "$ref": "#/$defs/vec2" },
66
+ "opacity": { "type": "number", "minimum": 0, "maximum": 1 }
67
+ },
68
+ "additionalProperties": false
69
+ },
70
+ "shape2d": {
71
+ "type": "object",
72
+ "required": ["type", "shape", "size", "fill"],
73
+ "properties": {
74
+ "type": { "const": "shape2d" },
75
+ "shape": { "enum": ["rect", "ellipse"] },
76
+ "size": { "$ref": "#/$defs/positiveVec2" },
77
+ "position": { "$ref": "#/$defs/vec2" },
78
+ "fill": { "$ref": "#/$defs/color" }
79
+ },
80
+ "additionalProperties": false
81
+ },
82
+ "sprite2d": {
83
+ "type": "object",
84
+ "required": ["type", "resource", "size"],
85
+ "properties": {
86
+ "type": { "const": "sprite2d" },
87
+ "resource": { "type": "string", "minLength": 1 },
88
+ "size": { "$ref": "#/$defs/positiveVec2" },
89
+ "position": { "$ref": "#/$defs/vec2" },
90
+ "tint": { "$ref": "#/$defs/color" },
91
+ "uvRect": { "type": "array", "items": { "type": "number", "minimum": 0, "maximum": 1 }, "minItems": 4, "maxItems": 4 },
92
+ "uvRectTrack": { "$ref": "#/$defs/spriteUvRectTrack" }
93
+ },
94
+ "additionalProperties": false
95
+ },
96
+ "path2d": {
97
+ "type": "object",
98
+ "required": ["type", "commands", "values", "fill"],
99
+ "properties": {
100
+ "type": { "const": "path2d" },
101
+ "commands": { "type": "string", "pattern": "^M[MLQCZ]*Z[MLQCZ]*$" },
102
+ "values": { "type": "array", "items": { "type": "number" } },
103
+ "fill": { "$ref": "#/$defs/color" },
104
+ "fillRule": { "enum": ["nonzero", "evenodd"] },
105
+ "tolerance": { "type": "number", "exclusiveMinimum": 0 }
106
+ },
107
+ "additionalProperties": false
108
+ },
109
+ "text2d": {
110
+ "type": "object",
111
+ "required": ["type", "text", "size", "color"],
112
+ "properties": {
113
+ "type": { "const": "text2d" },
114
+ "text": { "type": "string" },
115
+ "size": { "$ref": "#/$defs/positiveVec2" },
116
+ "position": { "$ref": "#/$defs/vec2" },
117
+ "fontFamily": { "type": "string", "minLength": 1 },
118
+ "fontSize": { "type": "number", "exclusiveMinimum": 0 },
119
+ "fontWeight": { "oneOf": [{ "type": "string", "minLength": 1 }, { "type": "number", "minimum": 1, "maximum": 1000 }] },
120
+ "fontStyle": { "enum": ["normal", "italic"] },
121
+ "fontResource": { "type": "string", "minLength": 1 },
122
+ "lineHeight": { "type": "number", "exclusiveMinimum": 0 },
123
+ "tracking": { "type": "number" },
124
+ "textAlign": { "enum": ["left", "center", "right"] },
125
+ "verticalAlign": { "enum": ["top", "middle", "bottom"] },
126
+ "color": { "$ref": "#/$defs/color" },
127
+ "backgroundColor": { "$ref": "#/$defs/color" },
128
+ "padding": { "type": "number", "minimum": 0 },
129
+ "resolutionScale": { "type": "number", "exclusiveMinimum": 0, "maximum": 4 },
130
+ "documents": { "type": "array", "minItems": 1, "maxItems": 128, "items": { "$ref": "#/$defs/textDocument" } },
131
+ "animators": { "type": "array", "minItems": 1, "maxItems": 16, "items": { "$ref": "#/$defs/textAnimator" } }
132
+ },
133
+ "additionalProperties": false
134
+ },
135
+ "textDocument": {
136
+ "type": "object", "required": ["time", "text"],
137
+ "properties": {
138
+ "time": { "type": "number", "minimum": 0 }, "text": { "type": "string" },
139
+ "fontFamily": { "type": "string", "minLength": 1 }, "fontSize": { "type": "number", "exclusiveMinimum": 0 },
140
+ "fontWeight": { "oneOf": [{ "type": "string", "minLength": 1 }, { "type": "number", "minimum": 1, "maximum": 1000 }] },
141
+ "fontStyle": { "enum": ["normal", "italic"] }, "fontResource": { "type": "string", "minLength": 1 },
142
+ "lineHeight": { "type": "number", "exclusiveMinimum": 0 }, "tracking": { "type": "number" },
143
+ "textAlign": { "enum": ["left", "center", "right"] }, "color": { "$ref": "#/$defs/color" }
144
+ }, "additionalProperties": false
145
+ },
146
+ "textSelector": {
147
+ "type": "object", "required": ["start", "end"],
148
+ "properties": {
149
+ "start": { "type": "number" }, "end": { "type": "number" }, "offset": { "type": "number" },
150
+ "units": { "enum": ["percent", "index"] }, "amount": { "type": "number", "minimum": -1, "maximum": 1 },
151
+ "shape": { "enum": ["square", "ramp-up", "ramp-down", "triangle", "round", "smooth"] },
152
+ "basedOn": { "enum": ["characters", "characters-excluding-spaces", "words", "lines"] },
153
+ "easing": { "type": "array", "items": { "type": "number", "minimum": 0, "maximum": 1 }, "minItems": 4, "maxItems": 4 },
154
+ "smoothness": { "type": "number", "minimum": 0, "maximum": 1 },
155
+ "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" }
158
+ }, "additionalProperties": false
159
+ },
160
+ "textAnimator": {
161
+ "type": "object", "required": ["selector"],
162
+ "properties": {
163
+ "selector": { "$ref": "#/$defs/textSelector" }, "position": { "$ref": "#/$defs/vec2" }, "scale": { "$ref": "#/$defs/vec2" },
164
+ "rotation": { "type": "number" }, "opacity": { "type": "number", "minimum": 0, "maximum": 1 },
165
+ "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" }
169
+ }, "additionalProperties": false
170
+ },
171
+ "particle2d": {
172
+ "type": "object",
173
+ "required": ["type", "maxParticles", "emissionRate", "lifetime", "speed", "angle", "startSize", "endSize", "startColor", "endColor"],
174
+ "properties": {
175
+ "type": { "const": "particle2d" },
176
+ "maxParticles": { "type": "integer", "minimum": 1, "maximum": 1000000 },
177
+ "emissionRate": { "type": "number", "minimum": 0 },
178
+ "burst": { "type": "integer", "minimum": 0 },
179
+ "duration": { "type": "number", "exclusiveMinimum": 0 },
180
+ "loop": { "type": "boolean" },
181
+ "seed": { "type": "integer" },
182
+ "lifetime": { "$ref": "#/$defs/vec2" },
183
+ "speed": { "$ref": "#/$defs/vec2" },
184
+ "angle": { "$ref": "#/$defs/vec2" },
185
+ "gravity": { "$ref": "#/$defs/vec2" },
186
+ "startSize": { "$ref": "#/$defs/vec2" },
187
+ "endSize": { "$ref": "#/$defs/vec2" },
188
+ "startColor": { "$ref": "#/$defs/color" },
189
+ "endColor": { "$ref": "#/$defs/color" },
190
+ "shape": { "enum": ["point", "box", "circle"] },
191
+ "shapeSize": { "$ref": "#/$defs/vec2" },
192
+ "shapeRadius": { "type": "number", "minimum": 0 },
193
+ "blendMode": { "enum": ["normal", "additive"] },
194
+ "resource": { "type": "string", "minLength": 1 },
195
+ "radial": { "type": "boolean" }
196
+ },
197
+ "additionalProperties": false
198
+ },
199
+ "audio": {
200
+ "type": "object",
201
+ "required": ["type", "resource"],
202
+ "properties": {
203
+ "type": { "const": "audio" },
204
+ "resource": { "type": "string", "minLength": 1 },
205
+ "volume": { "type": "number", "minimum": 0, "maximum": 1 },
206
+ "loop": { "type": "boolean" },
207
+ "startOffset": { "type": "number", "minimum": 0 },
208
+ "playbackRate": { "type": "number", "exclusiveMinimum": 0 }
209
+ },
210
+ "additionalProperties": false
211
+ },
212
+ "composite": {
213
+ "oneOf": [
214
+ { "$ref": "#/$defs/compositeLayer" },
215
+ {
216
+ "type": "object",
217
+ "required": ["layers"],
218
+ "properties": {
219
+ "layers": {
220
+ "type": "array",
221
+ "minItems": 1,
222
+ "maxItems": 8,
223
+ "items": { "$ref": "#/$defs/compositeLayer" }
224
+ }
225
+ },
226
+ "additionalProperties": false
227
+ }
228
+ ]
229
+ },
230
+ "compositeLayer": {
231
+ "type": "object",
232
+ "required": ["kind", "source", "mode"],
233
+ "properties": {
234
+ "kind": { "enum": ["mask", "matte"] },
235
+ "source": { "type": "string", "minLength": 1 },
236
+ "mode": { "enum": ["alpha", "alpha-inverted", "luma", "luma-inverted"] },
237
+ "operation": { "enum": ["add", "subtract", "intersect", "difference"] },
238
+ "feather": {
239
+ "type": "array",
240
+ "minItems": 2,
241
+ "maxItems": 2,
242
+ "items": { "type": "number", "minimum": 0 }
243
+ },
244
+ "expansion": { "type": "number" },
245
+ "expansionTrack": { "$ref": "#/$defs/vectorValueTrack" }
246
+ },
247
+ "additionalProperties": false
248
+ },
249
+ "vectorValueTrack": {
250
+ "type": "object",
251
+ "required": ["interpolation", "times", "values", "valueSize"],
252
+ "properties": {
253
+ "interpolation": { "enum": ["step", "linear", "cubic-bezier"] },
254
+ "times": { "type": "array", "minItems": 1, "items": { "type": "number", "minimum": 0 } },
255
+ "values": { "type": "array", "minItems": 1, "items": { "type": "number" } },
256
+ "valueSize": { "type": "integer", "minimum": 1 },
257
+ "easings": { "type": "array", "items": { "type": "number" } }
258
+ },
259
+ "additionalProperties": false
260
+ },
261
+ "spriteUvRectTrack": {
262
+ "type": "object",
263
+ "required": ["interpolation", "times", "values", "valueSize"],
264
+ "properties": {
265
+ "interpolation": { "const": "step" },
266
+ "times": { "type": "array", "minItems": 1, "items": { "type": "number", "minimum": 0 } },
267
+ "values": { "type": "array", "minItems": 4, "items": { "type": "number", "minimum": 0, "maximum": 1 } },
268
+ "valueSize": { "const": 4 }
269
+ },
270
+ "additionalProperties": false
271
+ },
272
+ "vectorSolidPaint": {
273
+ "type": "object",
274
+ "required": ["kind", "color"],
275
+ "properties": {
276
+ "kind": { "const": "solid" },
277
+ "color": { "$ref": "#/$defs/color" },
278
+ "colorTrack": { "$ref": "#/$defs/vectorValueTrack" },
279
+ "opacity": { "type": "number", "minimum": 0, "maximum": 1 },
280
+ "opacityTrack": { "$ref": "#/$defs/vectorValueTrack" }
281
+ },
282
+ "additionalProperties": false
283
+ },
284
+ "vectorGradientPaint": {
285
+ "type": "object",
286
+ "required": ["kind", "start", "end", "stops"],
287
+ "properties": {
288
+ "kind": { "enum": ["linear-gradient", "radial-gradient"] },
289
+ "start": { "$ref": "#/$defs/vec2" },
290
+ "end": { "$ref": "#/$defs/vec2" },
291
+ "stops": {
292
+ "type": "array",
293
+ "minItems": 10,
294
+ "maxItems": 40,
295
+ "items": { "type": "number", "minimum": 0, "maximum": 1 }
296
+ },
297
+ "startTrack": { "$ref": "#/$defs/vectorValueTrack" },
298
+ "endTrack": { "$ref": "#/$defs/vectorValueTrack" },
299
+ "stopsTrack": { "$ref": "#/$defs/vectorValueTrack" },
300
+ "opacity": { "type": "number", "minimum": 0, "maximum": 1 },
301
+ "opacityTrack": { "$ref": "#/$defs/vectorValueTrack" }
302
+ },
303
+ "additionalProperties": false
304
+ },
305
+ "vectorStroke": {
306
+ "type": "object",
307
+ "required": ["color", "width", "lineCap", "lineJoin", "miterLimit"],
308
+ "properties": {
309
+ "color": { "$ref": "#/$defs/color" },
310
+ "gradient": { "$ref": "#/$defs/vectorGradientPaint" },
311
+ "width": { "type": "number", "exclusiveMinimum": 0 },
312
+ "opacity": { "type": "number", "minimum": 0, "maximum": 1 },
313
+ "widthTrack": { "$ref": "#/$defs/vectorValueTrack" },
314
+ "lineCap": { "enum": ["butt", "round", "square"] },
315
+ "lineJoin": { "enum": ["miter", "round", "bevel"] },
316
+ "miterLimit": { "type": "number", "exclusiveMinimum": 0 },
317
+ "dash": { "type": "array", "minItems": 1, "maxItems": 32, "items": { "type": "number", "minimum": 0 } },
318
+ "dashOffset": { "type": "number" },
319
+ "dashOffsetTrack": { "$ref": "#/$defs/vectorValueTrack" }
320
+ },
321
+ "additionalProperties": false
322
+ },
323
+ "vectorShape": {
324
+ "type": "object",
325
+ "required": ["type", "commands", "values"],
326
+ "properties": {
327
+ "type": { "const": "org.haiyue.vector-shape@1" },
328
+ "commands": { "type": "string", "pattern": "^M[MLQCZ]*$" },
329
+ "values": { "type": "array", "items": { "type": "number" } },
330
+ "morph": { "$ref": "#/$defs/vectorValueTrack" },
331
+ "morphRelative": { "type": "boolean" },
332
+ "fill": {
333
+ "oneOf": [
334
+ { "$ref": "#/$defs/vectorSolidPaint" },
335
+ { "$ref": "#/$defs/vectorGradientPaint" }
336
+ ]
337
+ },
338
+ "stroke": { "$ref": "#/$defs/vectorStroke" },
339
+ "modifiers": {
340
+ "type": "array",
341
+ "minItems": 1,
342
+ "maxItems": 8,
343
+ "items": { "$ref": "#/$defs/vectorPathModifier" }
344
+ },
345
+ "fillRule": { "enum": ["nonzero", "evenodd"] },
346
+ "tolerance": { "type": "number", "exclusiveMinimum": 0 }
347
+ },
348
+ "anyOf": [{ "required": ["fill"] }, { "required": ["stroke"] }],
349
+ "additionalProperties": false
350
+ },
351
+ "vectorPathModifier": {
352
+ "oneOf": [
353
+ {
354
+ "type": "object",
355
+ "required": ["kind", "start", "end", "offset", "mode"],
356
+ "properties": {
357
+ "kind": { "const": "trim-path" },
358
+ "start": { "type": "number" },
359
+ "end": { "type": "number" },
360
+ "offset": { "type": "number" },
361
+ "mode": { "enum": ["simultaneous", "individual"] },
362
+ "startTrack": { "$ref": "#/$defs/vectorValueTrack" },
363
+ "endTrack": { "$ref": "#/$defs/vectorValueTrack" },
364
+ "offsetTrack": { "$ref": "#/$defs/vectorValueTrack" }
365
+ },
366
+ "additionalProperties": false
367
+ },
368
+ {
369
+ "type": "object",
370
+ "required": ["kind", "radius"],
371
+ "properties": {
372
+ "kind": { "const": "round-corners" },
373
+ "radius": { "type": "number", "minimum": 0 },
374
+ "radiusTrack": { "$ref": "#/$defs/vectorValueTrack" }
375
+ },
376
+ "additionalProperties": false
377
+ }
378
+ ]
379
+ },
380
+ "extensionComponent": {
381
+ "type": "object",
382
+ "required": ["type"],
383
+ "properties": { "type": { "$ref": "#/$defs/extensionId" } },
384
+ "not": {
385
+ "properties": { "type": { "const": "org.haiyue.vector-shape@1" } },
386
+ "required": ["type"]
387
+ },
388
+ "additionalProperties": true
389
+ },
390
+ "layerEffect": {
391
+ "oneOf": [
392
+ {
393
+ "type": "object", "required": ["kind", "black", "white", "amount"],
394
+ "properties": {
395
+ "kind": { "const": "tint" },
396
+ "black": { "type": "array", "minItems": 3, "maxItems": 3, "items": { "type": "number", "minimum": 0, "maximum": 1 } },
397
+ "white": { "type": "array", "minItems": 3, "maxItems": 3, "items": { "type": "number", "minimum": 0, "maximum": 1 } },
398
+ "amount": { "type": "number", "minimum": 0, "maximum": 1 },
399
+ "blackTrack": { "$ref": "#/$defs/vectorTrack" }, "whiteTrack": { "$ref": "#/$defs/vectorTrack" }, "amountTrack": { "$ref": "#/$defs/vectorTrack" }
400
+ }, "additionalProperties": false
401
+ },
402
+ {
403
+ "type": "object", "required": ["kind", "color"],
404
+ "properties": {
405
+ "kind": { "const": "fill" }, "color": { "$ref": "#/$defs/color" }, "opacity": { "type": "number", "minimum": 0, "maximum": 1 },
406
+ "colorTrack": { "$ref": "#/$defs/vectorTrack" }, "opacityTrack": { "$ref": "#/$defs/vectorTrack" }
407
+ }, "additionalProperties": false
408
+ },
409
+ {
410
+ "type": "object", "required": ["kind", "opacity"],
411
+ "properties": { "kind": { "const": "opacity" }, "opacity": { "type": "number", "minimum": 0, "maximum": 1 }, "opacityTrack": { "$ref": "#/$defs/vectorTrack" } },
412
+ "additionalProperties": false
413
+ },
414
+ {
415
+ "type": "object", "required": ["kind", "matrix"],
416
+ "properties": {
417
+ "kind": { "const": "color-matrix" }, "matrix": { "type": "array", "minItems": 20, "maxItems": 20, "items": { "type": "number" } },
418
+ "matrixTrack": { "$ref": "#/$defs/vectorTrack" }
419
+ }, "additionalProperties": false
420
+ },
421
+ {
422
+ "type": "object", "required": ["kind", "radius"],
423
+ "properties": { "kind": { "const": "blur" }, "radius": { "$ref": "#/$defs/nonNegativeVec2" }, "radiusTrack": { "$ref": "#/$defs/vectorTrack" } },
424
+ "additionalProperties": false
425
+ },
426
+ {
427
+ "type": "object", "required": ["kind", "color", "opacity", "offset", "blur"],
428
+ "properties": {
429
+ "kind": { "const": "drop-shadow" }, "color": { "$ref": "#/$defs/color" }, "opacity": { "type": "number", "minimum": 0, "maximum": 1 },
430
+ "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" }
433
+ }, "additionalProperties": false
434
+ }
435
+ ]
436
+ },
437
+ "node": {
438
+ "type": "object",
439
+ "required": ["id"],
440
+ "properties": {
441
+ "id": { "type": "string", "minLength": 1 },
442
+ "name": { "type": "string" },
443
+ "parent": { "type": "string", "minLength": 1 },
444
+ "start": { "type": "number", "minimum": 0 },
445
+ "duration": { "type": "number", "exclusiveMinimum": 0 },
446
+ "transform": { "$ref": "#/$defs/transform" },
447
+ "composite": { "$ref": "#/$defs/composite" },
448
+ "effects": { "type": "array", "minItems": 1, "maxItems": 8, "items": { "$ref": "#/$defs/layerEffect" } },
449
+ "components": { "type": "array", "items": { "oneOf": [{ "$ref": "#/$defs/shape2d" }, { "$ref": "#/$defs/path2d" }, { "$ref": "#/$defs/sprite2d" }, { "$ref": "#/$defs/text2d" }, { "$ref": "#/$defs/particle2d" }, { "$ref": "#/$defs/audio" }, { "$ref": "#/$defs/vectorShape" }, { "$ref": "#/$defs/extensionComponent" }] } },
450
+ "extensions": { "type": "object" }
451
+ },
452
+ "additionalProperties": false
453
+ },
454
+ "track": {
455
+ "type": "object",
456
+ "required": ["node", "property", "interpolation", "times", "values"],
457
+ "properties": {
458
+ "node": { "type": "string", "minLength": 1 },
459
+ "property": { "enum": ["position", "rotation", "scale", "opacity"] },
460
+ "interpolation": { "enum": ["step", "linear", "cubic-bezier"] },
461
+ "times": { "type": "array", "minItems": 1, "items": { "type": "number", "minimum": 0 } },
462
+ "values": { "type": "array", "minItems": 1, "items": { "type": "number" } },
463
+ "easings": { "type": "array", "items": { "type": "number" } },
464
+ "spatialTangents": { "type": "array", "items": { "type": "number" } }
465
+ },
466
+ "additionalProperties": false
467
+ },
468
+ "hyaStateMachineExtension": {
469
+ "type": "object",
470
+ "required": ["clips", "stateMachine"],
471
+ "properties": {
472
+ "clips": {
473
+ "type": "array",
474
+ "minItems": 1,
475
+ "maxItems": 10000,
476
+ "items": {
477
+ "type": "object",
478
+ "required": ["id", "start", "duration"],
479
+ "properties": {
480
+ "id": { "type": "string", "minLength": 1 },
481
+ "name": { "type": "string" },
482
+ "start": { "type": "number", "minimum": 0 },
483
+ "duration": { "type": "number", "exclusiveMinimum": 0 }
484
+ },
485
+ "additionalProperties": false
486
+ }
487
+ },
488
+ "stateMachine": { "$ref": "#/$defs/hyaStateMachine" }
489
+ },
490
+ "additionalProperties": false
491
+ },
492
+ "hyaStateMachine": {
493
+ "type": "object",
494
+ "required": ["format", "id", "name", "parameters", "layers"],
495
+ "properties": {
496
+ "format": { "const": "haiyue-animation-state-machine@1" },
497
+ "id": { "type": "string", "minLength": 1 },
498
+ "name": { "type": "string" },
499
+ "parameters": { "type": "array", "maxItems": 1000, "items": { "$ref": "#/$defs/hyaStateMachineParameter" } },
500
+ "layers": { "type": "array", "minItems": 1, "maxItems": 128, "items": { "$ref": "#/$defs/hyaStateMachineLayer" } }
501
+ },
502
+ "additionalProperties": false
503
+ },
504
+ "hyaStateMachineParameter": {
505
+ "oneOf": [
506
+ {
507
+ "type": "object", "required": ["name", "type", "defaultValue"],
508
+ "properties": { "name": { "type": "string", "minLength": 1 }, "type": { "const": "float" }, "defaultValue": { "type": "number" } },
509
+ "additionalProperties": false
510
+ },
511
+ {
512
+ "type": "object", "required": ["name", "type", "defaultValue"],
513
+ "properties": { "name": { "type": "string", "minLength": 1 }, "type": { "const": "integer" }, "defaultValue": { "type": "integer" } },
514
+ "additionalProperties": false
515
+ },
516
+ {
517
+ "type": "object", "required": ["name", "type", "defaultValue"],
518
+ "properties": { "name": { "type": "string", "minLength": 1 }, "type": { "const": "boolean" }, "defaultValue": { "type": "boolean" } },
519
+ "additionalProperties": false
520
+ },
521
+ {
522
+ "type": "object", "required": ["name", "type"],
523
+ "properties": { "name": { "type": "string", "minLength": 1 }, "type": { "const": "trigger" } },
524
+ "additionalProperties": false
525
+ }
526
+ ]
527
+ },
528
+ "hyaStateMachineMotion": {
529
+ "oneOf": [
530
+ {
531
+ "type": "object", "required": ["kind", "clipId"],
532
+ "properties": { "kind": { "const": "clip" }, "clipId": { "type": "string", "minLength": 1 } },
533
+ "additionalProperties": false
534
+ },
535
+ {
536
+ "type": "object", "required": ["kind", "parameter", "children"],
537
+ "properties": {
538
+ "kind": { "const": "blend-1d" }, "parameter": { "type": "string", "minLength": 1 },
539
+ "children": { "type": "array", "minItems": 1, "maxItems": 4096, "items": {
540
+ "type": "object", "required": ["threshold", "motion"],
541
+ "properties": { "threshold": { "type": "number" }, "motion": { "$ref": "#/$defs/hyaStateMachineMotion" } },
542
+ "additionalProperties": false
543
+ } }
544
+ },
545
+ "additionalProperties": false
546
+ },
547
+ {
548
+ "type": "object", "required": ["kind", "algorithm", "parameterX", "parameterY", "children"],
549
+ "properties": {
550
+ "kind": { "const": "blend-2d" }, "algorithm": { "enum": ["cartesian", "directional"] },
551
+ "parameterX": { "type": "string", "minLength": 1 }, "parameterY": { "type": "string", "minLength": 1 },
552
+ "children": { "type": "array", "minItems": 1, "maxItems": 4096, "items": {
553
+ "type": "object", "required": ["position", "motion"],
554
+ "properties": { "position": { "$ref": "#/$defs/vec2" }, "motion": { "$ref": "#/$defs/hyaStateMachineMotion" } },
555
+ "additionalProperties": false
556
+ } }
557
+ },
558
+ "additionalProperties": false
559
+ }
560
+ ]
561
+ },
562
+ "hyaStateMachineCondition": {
563
+ "type": "object",
564
+ "required": ["parameter", "operator"],
565
+ "properties": {
566
+ "parameter": { "type": "string", "minLength": 1 },
567
+ "operator": { "enum": ["greater", "greater-or-equal", "less", "less-or-equal", "equal", "not-equal", "is-true", "is-false", "triggered"] },
568
+ "value": { "type": ["number", "boolean"] }
569
+ },
570
+ "additionalProperties": false
571
+ },
572
+ "hyaStateMachineLayer": {
573
+ "type": "object",
574
+ "required": ["id", "name", "initialStateId", "states", "transitions"],
575
+ "properties": {
576
+ "id": { "type": "string", "minLength": 1 }, "name": { "type": "string" },
577
+ "initialStateId": { "type": "string", "minLength": 1 },
578
+ "states": { "type": "array", "minItems": 1, "items": {
579
+ "type": "object", "required": ["id", "name", "motion"],
580
+ "properties": {
581
+ "id": { "type": "string", "minLength": 1 }, "name": { "type": "string" },
582
+ "motion": { "$ref": "#/$defs/hyaStateMachineMotion" }, "speed": { "type": "number" },
583
+ "speedParameter": { "type": "string", "minLength": 1 }, "loop": { "enum": ["once", "repeat", "ping-pong"] }
584
+ },
585
+ "additionalProperties": false
586
+ } },
587
+ "transitions": { "type": "array", "items": {
588
+ "type": "object", "required": ["id", "from", "to", "conditions", "duration"],
589
+ "properties": {
590
+ "id": { "type": "string", "minLength": 1 }, "from": { "type": "string", "minLength": 1 }, "to": { "type": "string", "minLength": 1 },
591
+ "conditions": { "type": "array", "items": { "$ref": "#/$defs/hyaStateMachineCondition" } },
592
+ "duration": { "type": "number", "minimum": 0 }, "hasExitTime": { "type": "boolean" },
593
+ "exitTime": { "type": "number", "minimum": 0 }, "destinationOffset": { "type": "number", "minimum": 0 },
594
+ "interruption": { "enum": ["none", "source", "destination", "source-then-destination", "destination-then-source"] }
595
+ },
596
+ "additionalProperties": false
597
+ } },
598
+ "blendMode": { "enum": ["override", "additive"] }, "weight": { "type": "number", "minimum": 0, "maximum": 1 },
599
+ "mask": {
600
+ "type": "object",
601
+ "properties": {
602
+ "include": { "type": "array", "uniqueItems": true, "items": { "type": "string", "minLength": 1 } },
603
+ "exclude": { "type": "array", "uniqueItems": true, "items": { "type": "string", "minLength": 1 } }
604
+ },
605
+ "additionalProperties": false
606
+ }
607
+ },
608
+ "additionalProperties": false
609
+ }
610
+ }
611
+ }