@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,130 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "format": "haiyue-animation-3d-contract",
4
+ "version": 1,
5
+ "extension": {
6
+ "id": "org.haiyue.animation-3d@1",
7
+ "payloadFormat": "haiyue-animation-3d@1",
8
+ "required": true,
9
+ "carrierFormat": "haiyue-animation",
10
+ "carrierVersion": "1.0",
11
+ "binaryWriteVersion": 2,
12
+ "binaryReadVersions": [1, 2],
13
+ "coreNodesPolicy": "must-be-empty",
14
+ "coreTracksPolicy": "must-be-empty"
15
+ },
16
+ "projects": {
17
+ "2d": {
18
+ "format": "haiyue-animation-editor-project@1",
19
+ "schemaVersion": 1,
20
+ "mode": "2d",
21
+ "coordinateSystem": "screen-y-down"
22
+ },
23
+ "3d": {
24
+ "format": "haiyue-animation-editor-project-3d@1",
25
+ "schemaVersion": 1,
26
+ "mode": "3d",
27
+ "coordinateSystem": "right-handed-y-up"
28
+ },
29
+ "mixedComposition": {
30
+ "policy": "reject",
31
+ "code": "E_PROJECT_MIXED_DIMENSIONS",
32
+ "path": "$.mode"
33
+ }
34
+ },
35
+ "coordinates": {
36
+ "handedness": "right",
37
+ "upAxis": "+y",
38
+ "forwardAxis": "-z",
39
+ "linearUnit": "meter",
40
+ "angles": "radian",
41
+ "rotationStorage": "normalized-xyzw-quaternion",
42
+ "timeUnit": "second"
43
+ },
44
+ "runtime": {
45
+ "ownerPackage": "@haiyue/extensions/animation3d",
46
+ "clipFormat": "haiyue-animation3d-clip@1",
47
+ "stateMachineFormat": "haiyue-animation3d-state-machine@1",
48
+ "bindingResolver": "Animation3DBindingResolver",
49
+ "mixer": "Animation3DMixer",
50
+ "modelAdapter": "@haiyue/extensions/gltf",
51
+ "particleComponent": "@haiyue/engine ParticleEmitter3D",
52
+ "engineRootExportChange": false
53
+ },
54
+ "bindings": {
55
+ "targets": ["node-id", "node-path", "slot"],
56
+ "paths": [
57
+ "transform.translation",
58
+ "transform.rotation",
59
+ "transform.scale",
60
+ "morph.weights",
61
+ "property"
62
+ ],
63
+ "interpolations": ["step", "linear", "cubic-spline"],
64
+ "materialComponent": "material3d",
65
+ "materialProperties": {
66
+ "baseColorFactor": { "valueType": "vec4", "valueSize": 4 },
67
+ "metallicFactor": { "valueType": "scalar", "valueSize": 1 },
68
+ "roughnessFactor": { "valueType": "scalar", "valueSize": 1 },
69
+ "emissiveFactor": { "valueType": "vec3", "valueSize": 3 },
70
+ "alphaCutoff": { "valueType": "scalar", "valueSize": 1 }
71
+ },
72
+ "cameraComponent": "camera3d",
73
+ "cameraProperties": {
74
+ "fovYRadians": { "valueType": "scalar", "valueSize": 1 },
75
+ "near": { "valueType": "scalar", "valueSize": 1 },
76
+ "far": { "valueType": "scalar", "valueSize": 1 },
77
+ "orthoHeight": { "valueType": "scalar", "valueSize": 1 }
78
+ }
79
+ },
80
+ "resources": {
81
+ "modelCoreType": "binary",
82
+ "modelMimeTypes": ["model/gltf-binary", "model/gltf+json"],
83
+ "deliveryUriSchemes": ["package-relative", "https", "data"],
84
+ "forbiddenDeliveryUriSchemes": ["blob", "file", "javascript"],
85
+ "packageAssetPath": "assets/<sha256>.<ext>",
86
+ "packageManifest": "manifest.json",
87
+ "packageDeterministic": true,
88
+ "dependencyReferences": "asset-id"
89
+ },
90
+ "degradation": [
91
+ {
92
+ "feature": "preview-only-editor-state",
93
+ "action": "strip",
94
+ "severity": "info"
95
+ },
96
+ {
97
+ "feature": "unsupported-renderable-or-channel",
98
+ "action": "reject",
99
+ "code": "E_ANIMATION_3D_UNSUPPORTED_FEATURE"
100
+ },
101
+ {
102
+ "feature": "mixed-2d-3d-carrier",
103
+ "action": "reject",
104
+ "code": "E_ANIMATION_3D_MIXED_DIMENSIONS"
105
+ },
106
+ {
107
+ "feature": "missing-required-3d-runtime",
108
+ "action": "reject",
109
+ "code": "E_ANIMATION_MISSING_EXTENSION"
110
+ },
111
+ {
112
+ "feature": "pseudo-3d-projection-fallback",
113
+ "action": "forbidden"
114
+ }
115
+ ],
116
+ "diagnostics": [
117
+ { "code": "E_ANIMATION_INVALID_BINARY", "path": "$", "meaning": "unknown-or-invalid-container-version" },
118
+ { "code": "E_ANIMATION_UNSUPPORTED_VERSION", "path": "$.version", "meaning": "unsupported-core-document-version" },
119
+ { "code": "E_ANIMATION_MISSING_EXTENSION", "path": "$.extensionsRequired", "meaning": "missing-or-unknown-required-extension-major" },
120
+ { "code": "E_ANIMATION_3D_INVALID_PAYLOAD", "path": "$.extensions.org.haiyue.animation-3d@1", "meaning": "invalid-3d-extension-payload" },
121
+ { "code": "E_ANIMATION_3D_MIXED_DIMENSIONS", "path": "$.nodes", "meaning": "2d-core-content-present-in-3d-carrier" },
122
+ { "code": "E_ANIMATION_3D_UNSUPPORTED_FEATURE", "path": "$.extensions.org.haiyue.animation-3d@1", "meaning": "recognized-but-unsupported-3d-feature" },
123
+ { "code": "E_ANIMATION_3D_UNKNOWN_RESOURCE", "path": "$.extensions.org.haiyue.animation-3d@1.nodes", "meaning": "missing-model-material-or-texture-reference" },
124
+ { "code": "E_ANIMATION_3D_BINDING_MISMATCH", "path": "$.extensions.org.haiyue.animation-3d@1.clips", "meaning": "binding-value-width-or-target-mismatch" },
125
+ { "code": "E_ANIMATION_3D_LIMIT_EXCEEDED", "path": "$.extensions.org.haiyue.animation-3d@1", "meaning": "3d-allocation-budget-exceeded" },
126
+ { "code": "E_PROJECT_INVALID_FORMAT", "path": "$.format", "meaning": "unknown-project-family" },
127
+ { "code": "E_PROJECT_UNSUPPORTED_VERSION", "path": "$.schemaVersion", "meaning": "unsupported-project-schema-version" },
128
+ { "code": "E_PROJECT_MIXED_DIMENSIONS", "path": "$.mode", "meaning": "mixed-project-mode-is-not-supported" }
129
+ ]
130
+ }