@haiyue/extensions 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 (293) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +30 -0
  3. package/dist/animation/Animation2DComponent.d.ts +46 -0
  4. package/dist/animation/Animation2DExtensionRegistry.d.ts +27 -0
  5. package/dist/animation/Animation2DRenderSystem.d.ts +89 -0
  6. package/dist/animation/Animation2DRuntime.d.ts +99 -0
  7. package/dist/animation/Animation2DStateMachine.d.ts +13 -0
  8. package/dist/animation/Animation2DStateMachineComponent.d.ts +54 -0
  9. package/dist/animation/Animation2DStateMachineRuntime.d.ts +30 -0
  10. package/dist/animation/Animation2DStateMachineSystem.d.ts +14 -0
  11. package/dist/animation/Animation2DStateMachineVisualRuntime.d.ts +27 -0
  12. package/dist/animation/Animation2DSystem.d.ts +14 -0
  13. package/dist/animation/AnimationAssetLoader.d.ts +9 -0
  14. package/dist/animation/AnimationAudioClip.d.ts +26 -0
  15. package/dist/animation/AnimationPathTessellator.d.ts +52 -0
  16. package/dist/animation/AnimationTextRasterizer.d.ts +21 -0
  17. package/dist/animation/AnimationVisual2D.d.ts +68 -0
  18. package/dist/animation/HyaAnimation2DClipAdapter.d.ts +16 -0
  19. package/dist/animation/Particle2DDescriptorAdapter.d.ts +5 -0
  20. package/dist/animation/runtime/mixer/Action.d.ts +150 -0
  21. package/dist/animation/runtime/mixer/Mixer.d.ts +54 -0
  22. package/dist/animation/runtime/mixer/PoseBuffer.d.ts +23 -0
  23. package/dist/animation/runtime/mixer/Sampler.d.ts +17 -0
  24. package/dist/animation/runtime/mixer/Types.d.ts +101 -0
  25. package/dist/animation/runtime/mixer/index.d.ts +6 -0
  26. package/dist/animation-state-machine/AnimationStateMachine.d.ts +111 -0
  27. package/dist/animation-state-machine/AnimationStateMachineChannels.d.ts +23 -0
  28. package/dist/animation-state-machine/runtime/Animation2DStateMachineMixerAdapter.d.ts +51 -0
  29. package/dist/animation-state-machine/runtime/AnimationStateMachineBlendTreeWeights.d.ts +14 -0
  30. package/dist/animation-state-machine/runtime/AnimationStateMachineCompiler.d.ts +109 -0
  31. package/dist/animation-state-machine/runtime/AnimationStateMachineController.d.ts +103 -0
  32. package/dist/animation-state-machine/runtime/AnimationStateMachineMixerPort.d.ts +35 -0
  33. package/dist/animation-state-machine/runtime/index.d.ts +7 -0
  34. package/dist/animation.d.ts +15 -0
  35. package/dist/animation.js +1171 -0
  36. package/dist/animation3d/Animation3DAction.d.ts +46 -0
  37. package/dist/animation3d/Animation3DBinding.d.ts +85 -0
  38. package/dist/animation3d/Animation3DClip.d.ts +20 -0
  39. package/dist/animation3d/Animation3DError.d.ts +13 -0
  40. package/dist/animation3d/Animation3DMixer.d.ts +27 -0
  41. package/dist/animation3d/Animation3DPose.d.ts +40 -0
  42. package/dist/animation3d/Animation3DPoseBuffer.d.ts +24 -0
  43. package/dist/animation3d/Animation3DResource.d.ts +28 -0
  44. package/dist/animation3d/Animation3DStateMachine.d.ts +95 -0
  45. package/dist/animation3d/Animation3DStateMachineRuntime.d.ts +70 -0
  46. package/dist/animation3d/Animation3DTrack.d.ts +19 -0
  47. package/dist/animation3d/hya/HyaAnimation3DRuntime.d.ts +73 -0
  48. package/dist/animation3d/hya/HyaAnimation3DStateMachineRuntime.d.ts +65 -0
  49. package/dist/animation3d/hya/HyaAnimation3DTypes.d.ts +170 -0
  50. package/dist/animation3d/hya/index.d.ts +4 -0
  51. package/dist/animation3d/index.d.ts +14 -0
  52. package/dist/animation3d/runtime/integration/Animation3DStateMachineMixerAdapter.d.ts +81 -0
  53. package/dist/animation3d/runtime/integration/Animation3DStateMachineMixerIntegration.d.ts +39 -0
  54. package/dist/animation3d/runtime/integration/index.d.ts +2 -0
  55. package/dist/animation3d/runtime/mixer/Action.d.ts +150 -0
  56. package/dist/animation3d/runtime/mixer/Animation3DMixerRuntimeStore.d.ts +6 -0
  57. package/dist/animation3d/runtime/mixer/Mixer.d.ts +59 -0
  58. package/dist/animation3d/runtime/mixer/PoseBuffer.d.ts +1 -0
  59. package/dist/animation3d/runtime/mixer/TrackSampler.d.ts +24 -0
  60. package/dist/animation3d/runtime/mixer/index.d.ts +4 -0
  61. package/dist/animation3d/runtime/state-machine/Animation3DBlendTreeWeights.d.ts +1 -0
  62. package/dist/animation3d/runtime/state-machine/Animation3DStateMachineCompiler.d.ts +1 -0
  63. package/dist/animation3d/runtime/state-machine/Animation3DStateMachineController.d.ts +1 -0
  64. package/dist/animation3d/runtime/state-machine/Animation3DStateMachineMixerPort.d.ts +1 -0
  65. package/dist/animation3d/runtime/state-machine/index.d.ts +6 -0
  66. package/dist/animation3d.d.ts +5 -0
  67. package/dist/animation3d.js +1708 -0
  68. package/dist/benchmark.d.ts +30 -0
  69. package/dist/benchmark.js +119 -0
  70. package/dist/canvas-text/CanvasText2DRenderSystem.d.ts +24 -0
  71. package/dist/canvas-text/CanvasTextComponent.d.ts +18 -0
  72. package/dist/canvas-text.d.ts +4 -0
  73. package/dist/canvas-text.js +276 -0
  74. package/dist/chunks/2d-ui-animation-2d.generated-D4aHzFU2.js +4 -0
  75. package/dist/chunks/2d-ui-canvas-text-2d.generated-C0Eaej2m.js +4 -0
  76. package/dist/chunks/2d-ui-spine2d.generated-CUUi8xjl.js +4 -0
  77. package/dist/chunks/2d-ui-tilemap2d.generated-gebw4mX7.js +4 -0
  78. package/dist/chunks/Animation2DStateMachine-9IonguNa.js +3245 -0
  79. package/dist/chunks/AnimationStateMachineController-BIcAh-sT.js +1438 -0
  80. package/dist/chunks/GltfAnimation3DAdapter-Cu3rQQsW.js +2240 -0
  81. package/dist/chunks/GltfAnimationRuntime-CRHsLycN.js +631 -0
  82. package/dist/chunks/RenderSystem2DBase-DDT61dAu.js +227 -0
  83. package/dist/chunks/Spine2DRuntime-D9M9LAQR.js +3056 -0
  84. package/dist/chunks/SpineAssetParser-BSDmPge1.js +378 -0
  85. package/dist/chunks/gltfLoader-Dm22jLYB.js +2085 -0
  86. package/dist/chunks/pluginUtils-CvwroRMd.js +33 -0
  87. package/dist/experimental-gltf-worker.d.ts +4 -0
  88. package/dist/experimental-gltf-worker.js +138 -0
  89. package/dist/experimental-spine-worker.d.ts +4 -0
  90. package/dist/experimental-spine-worker.js +110 -0
  91. package/dist/gltf/GltfAccessorReader.d.ts +7 -0
  92. package/dist/gltf/GltfAnimation3DAdapter.d.ts +47 -0
  93. package/dist/gltf/GltfAnimationRuntime.d.ts +10 -0
  94. package/dist/gltf/GltfAssetWorkerClient.d.ts +20 -0
  95. package/dist/gltf/GltfCompatibilityReport.d.ts +70 -0
  96. package/dist/gltf/GltfConservativeBounds.d.ts +18 -0
  97. package/dist/gltf/GltfDracoDecoder.d.ts +4 -0
  98. package/dist/gltf/GltfExtensionAdapter.d.ts +54 -0
  99. package/dist/gltf/GltfLoaderContract.d.ts +249 -0
  100. package/dist/gltf/GltfLoaderErrors.d.ts +4 -0
  101. package/dist/gltf/GltfMaterialDescriptor.d.ts +23 -0
  102. package/dist/gltf/GltfMaterialEncoder.d.ts +20 -0
  103. package/dist/gltf/GltfMaterialLoader.d.ts +6 -0
  104. package/dist/gltf/GltfModelComponent.d.ts +72 -0
  105. package/dist/gltf/GltfModelSystem.d.ts +37 -0
  106. package/dist/gltf/GltfPlugin.d.ts +6 -0
  107. package/dist/gltf/GltfSchema.d.ts +225 -0
  108. package/dist/gltf/GltfUvSemanticPlanner.d.ts +33 -0
  109. package/dist/gltf/gltfLoader.d.ts +9 -0
  110. package/dist/gltf-animation3d.d.ts +3 -0
  111. package/dist/gltf-animation3d.js +8 -0
  112. package/dist/gltf-worker-runtime.d.ts +7 -0
  113. package/dist/gltf-worker-runtime.js +6981 -0
  114. package/dist/gltf.d.ts +12 -0
  115. package/dist/gltf.js +517 -0
  116. package/dist/grid/Grid2DComponent.d.ts +25 -0
  117. package/dist/grid.d.ts +2 -0
  118. package/dist/grid.js +56 -0
  119. package/dist/hya-state-machine.d.ts +7 -0
  120. package/dist/hya-state-machine.js +2934 -0
  121. package/dist/index.d.ts +2 -0
  122. package/dist/index.js +7 -0
  123. package/dist/internal/2d-ui-shader-artifact.js +870 -0
  124. package/dist/plugins/pluginUtils.d.ts +20 -0
  125. package/dist/plugins.d.ts +6 -0
  126. package/dist/shaders/generated/2d-ui-artifact.generated.d.ts +658 -0
  127. package/dist/spine/Spine2DComponent.d.ts +116 -0
  128. package/dist/spine/Spine2DGpuRenderer.d.ts +65 -0
  129. package/dist/spine/Spine2DRenderSystem.d.ts +27 -0
  130. package/dist/spine/Spine2DRuntime.d.ts +103 -0
  131. package/dist/spine/SpineAnimationBoneTimelines.d.ts +8 -0
  132. package/dist/spine/SpineAssetParser.d.ts +18 -0
  133. package/dist/spine/SpineAssetWorkerClient.d.ts +19 -0
  134. package/dist/spine/SpineAssetWorkerContract.d.ts +6 -0
  135. package/dist/spine/SpineAtlasParser.d.ts +21 -0
  136. package/dist/spine/SpineFloatBuilder.d.ts +15 -0
  137. package/dist/spine/SpinePathConstraintSolver.d.ts +32 -0
  138. package/dist/spine/SpinePlugin.d.ts +8 -0
  139. package/dist/spine/SpineSkeletonRuntime.d.ts +185 -0
  140. package/dist/spine/SpineSlotAnimation.d.ts +17 -0
  141. package/dist/spine/SpineTimelineRuntime.d.ts +25 -0
  142. package/dist/spine/SpineVertexBuilder.d.ts +61 -0
  143. package/dist/spine.d.ts +7 -0
  144. package/dist/spine.js +578 -0
  145. package/dist/tilemap/Tilemap2DComponent.d.ts +110 -0
  146. package/dist/tilemap/Tilemap2DRenderSystem.d.ts +11 -0
  147. package/dist/tilemap/Tilemap2DRenderer.d.ts +24 -0
  148. package/dist/tilemap/TilemapPlugin.d.ts +8 -0
  149. package/dist/tilemap.d.ts +6 -0
  150. package/dist/tilemap.js +535 -0
  151. package/dist/tween/Tween2DComponent.d.ts +70 -0
  152. package/dist/tween/Tween2DSystem.d.ts +12 -0
  153. package/dist/tween.d.ts +4 -0
  154. package/dist/tween.js +138 -0
  155. package/dist/utils/RenderSystem2DBase.d.ts +42 -0
  156. package/dist/utils/arrayAccess.d.ts +4 -0
  157. package/dist/utils/camera2d.d.ts +12 -0
  158. package/dist/utils/render2dGpu.d.ts +32 -0
  159. package/package.json +124 -0
  160. package/src/animation/Animation2DComponent.ts +135 -0
  161. package/src/animation/Animation2DExtensionRegistry.ts +52 -0
  162. package/src/animation/Animation2DRenderSystem.ts +1026 -0
  163. package/src/animation/Animation2DRuntime.ts +1326 -0
  164. package/src/animation/Animation2DStateMachine.ts +39 -0
  165. package/src/animation/Animation2DStateMachineComponent.ts +228 -0
  166. package/src/animation/Animation2DStateMachineRuntime.ts +141 -0
  167. package/src/animation/Animation2DStateMachineSystem.ts +60 -0
  168. package/src/animation/Animation2DStateMachineVisualRuntime.ts +282 -0
  169. package/src/animation/Animation2DSystem.ts +72 -0
  170. package/src/animation/AnimationAssetLoader.ts +84 -0
  171. package/src/animation/AnimationAudioClip.ts +140 -0
  172. package/src/animation/AnimationPathTessellator.ts +691 -0
  173. package/src/animation/AnimationTextRasterizer.ts +340 -0
  174. package/src/animation/AnimationVisual2D.ts +153 -0
  175. package/src/animation/HyaAnimation2DClipAdapter.ts +845 -0
  176. package/src/animation/Particle2DDescriptorAdapter.ts +35 -0
  177. package/src/animation/runtime/mixer/Action.ts +876 -0
  178. package/src/animation/runtime/mixer/Mixer.ts +505 -0
  179. package/src/animation/runtime/mixer/PoseBuffer.ts +105 -0
  180. package/src/animation/runtime/mixer/Sampler.ts +252 -0
  181. package/src/animation/runtime/mixer/Types.ts +138 -0
  182. package/src/animation/runtime/mixer/index.ts +31 -0
  183. package/src/animation-state-machine/AnimationStateMachine.ts +146 -0
  184. package/src/animation-state-machine/AnimationStateMachineChannels.ts +116 -0
  185. package/src/animation-state-machine/runtime/Animation2DStateMachineMixerAdapter.ts +197 -0
  186. package/src/animation-state-machine/runtime/AnimationStateMachineBlendTreeWeights.ts +503 -0
  187. package/src/animation-state-machine/runtime/AnimationStateMachineCompiler.ts +763 -0
  188. package/src/animation-state-machine/runtime/AnimationStateMachineController.ts +987 -0
  189. package/src/animation-state-machine/runtime/AnimationStateMachineMixerPort.ts +54 -0
  190. package/src/animation-state-machine/runtime/index.ts +47 -0
  191. package/src/animation.ts +33 -0
  192. package/src/animation3d/Animation3DAction.ts +73 -0
  193. package/src/animation3d/Animation3DBinding.ts +116 -0
  194. package/src/animation3d/Animation3DClip.ts +22 -0
  195. package/src/animation3d/Animation3DError.ts +34 -0
  196. package/src/animation3d/Animation3DMixer.ts +82 -0
  197. package/src/animation3d/Animation3DPose.ts +100 -0
  198. package/src/animation3d/Animation3DPoseBuffer.ts +85 -0
  199. package/src/animation3d/Animation3DResource.ts +49 -0
  200. package/src/animation3d/Animation3DStateMachine.ts +126 -0
  201. package/src/animation3d/Animation3DStateMachineRuntime.ts +191 -0
  202. package/src/animation3d/Animation3DTrack.ts +29 -0
  203. package/src/animation3d/hya/HyaAnimation3DRuntime.ts +756 -0
  204. package/src/animation3d/hya/HyaAnimation3DStateMachineRuntime.ts +618 -0
  205. package/src/animation3d/hya/HyaAnimation3DTypes.ts +168 -0
  206. package/src/animation3d/hya/index.ts +10 -0
  207. package/src/animation3d/index.ts +76 -0
  208. package/src/animation3d/runtime/integration/Animation3DStateMachineMixerAdapter.ts +325 -0
  209. package/src/animation3d/runtime/integration/Animation3DStateMachineMixerIntegration.ts +158 -0
  210. package/src/animation3d/runtime/integration/index.ts +9 -0
  211. package/src/animation3d/runtime/mixer/Action.ts +833 -0
  212. package/src/animation3d/runtime/mixer/Animation3DMixerRuntimeStore.ts +26 -0
  213. package/src/animation3d/runtime/mixer/Mixer.ts +562 -0
  214. package/src/animation3d/runtime/mixer/PoseBuffer.ts +1 -0
  215. package/src/animation3d/runtime/mixer/TrackSampler.ts +399 -0
  216. package/src/animation3d/runtime/mixer/index.ts +8 -0
  217. package/src/animation3d/runtime/state-machine/Animation3DBlendTreeWeights.ts +4 -0
  218. package/src/animation3d/runtime/state-machine/Animation3DStateMachineCompiler.ts +1 -0
  219. package/src/animation3d/runtime/state-machine/Animation3DStateMachineController.ts +1 -0
  220. package/src/animation3d/runtime/state-machine/Animation3DStateMachineMixerPort.ts +1 -0
  221. package/src/animation3d/runtime/state-machine/index.ts +45 -0
  222. package/src/animation3d.ts +5 -0
  223. package/src/benchmark.ts +168 -0
  224. package/src/canvas-text/CanvasText2DRenderSystem.ts +292 -0
  225. package/src/canvas-text/CanvasTextComponent.ts +47 -0
  226. package/src/canvas-text.ts +4 -0
  227. package/src/experimental-gltf-worker.ts +18 -0
  228. package/src/experimental-spine-worker.ts +9 -0
  229. package/src/gltf/GltfAccessorReader.ts +271 -0
  230. package/src/gltf/GltfAnimation3DAdapter.ts +680 -0
  231. package/src/gltf/GltfAnimationRuntime.ts +392 -0
  232. package/src/gltf/GltfAssetWorkerClient.ts +136 -0
  233. package/src/gltf/GltfCompatibilityReport.ts +214 -0
  234. package/src/gltf/GltfConservativeBounds.ts +219 -0
  235. package/src/gltf/GltfDracoDecoder.ts +251 -0
  236. package/src/gltf/GltfExtensionAdapter.ts +340 -0
  237. package/src/gltf/GltfLoaderContract.ts +333 -0
  238. package/src/gltf/GltfLoaderErrors.ts +59 -0
  239. package/src/gltf/GltfMaterialDescriptor.ts +134 -0
  240. package/src/gltf/GltfMaterialEncoder.ts +173 -0
  241. package/src/gltf/GltfMaterialLoader.ts +293 -0
  242. package/src/gltf/GltfModelComponent.ts +115 -0
  243. package/src/gltf/GltfModelSystem.ts +208 -0
  244. package/src/gltf/GltfPlugin.ts +84 -0
  245. package/src/gltf/GltfSchema.ts +229 -0
  246. package/src/gltf/GltfUvSemanticPlanner.ts +166 -0
  247. package/src/gltf/gltfLoader.ts +910 -0
  248. package/src/gltf-animation3d.ts +10 -0
  249. package/src/gltf-worker-runtime.ts +10 -0
  250. package/src/gltf.ts +56 -0
  251. package/src/grid/Grid2DComponent.ts +69 -0
  252. package/src/grid.ts +2 -0
  253. package/src/hya-state-machine.ts +19 -0
  254. package/src/index.ts +2 -0
  255. package/src/plugins/pluginUtils.ts +50 -0
  256. package/src/plugins.ts +6 -0
  257. package/src/shaders/generated/2d-ui-animation-2d.generated.wgsl +242 -0
  258. package/src/shaders/generated/2d-ui-artifact.generated.ts +867 -0
  259. package/src/shaders/generated/2d-ui-canvas-text-2d.generated.wgsl +38 -0
  260. package/src/shaders/generated/2d-ui-spine2d.generated.wgsl +41 -0
  261. package/src/shaders/generated/2d-ui-tilemap2d.generated.wgsl +36 -0
  262. package/src/spine/Spine2DComponent.ts +168 -0
  263. package/src/spine/Spine2DGpuRenderer.ts +449 -0
  264. package/src/spine/Spine2DRenderSystem.ts +199 -0
  265. package/src/spine/Spine2DRuntime.ts +1529 -0
  266. package/src/spine/SpineAnimationBoneTimelines.ts +30 -0
  267. package/src/spine/SpineAssetParser.ts +20 -0
  268. package/src/spine/SpineAssetWorkerClient.ts +112 -0
  269. package/src/spine/SpineAssetWorkerContract.ts +4 -0
  270. package/src/spine/SpineAtlasParser.ts +127 -0
  271. package/src/spine/SpineFloatBuilder.ts +66 -0
  272. package/src/spine/SpinePathConstraintSolver.ts +582 -0
  273. package/src/spine/SpinePlugin.ts +76 -0
  274. package/src/spine/SpineSkeletonRuntime.ts +521 -0
  275. package/src/spine/SpineSlotAnimation.ts +195 -0
  276. package/src/spine/SpineTimelineRuntime.ts +453 -0
  277. package/src/spine/SpineVertexBuilder.ts +686 -0
  278. package/src/spine.ts +7 -0
  279. package/src/tilemap/Tilemap2DComponent.ts +232 -0
  280. package/src/tilemap/Tilemap2DRenderSystem.ts +58 -0
  281. package/src/tilemap/Tilemap2DRenderer.ts +289 -0
  282. package/src/tilemap/TilemapPlugin.ts +75 -0
  283. package/src/tilemap.ts +6 -0
  284. package/src/tween/Tween2DComponent.ts +83 -0
  285. package/src/tween/Tween2DSystem.ts +78 -0
  286. package/src/tween.ts +4 -0
  287. package/src/types/earcut.d.ts +7 -0
  288. package/src/types/wgsl.d.ts +4 -0
  289. package/src/utils/RenderSystem2DBase.ts +164 -0
  290. package/src/utils/arrayAccess.ts +17 -0
  291. package/src/utils/camera2d.ts +68 -0
  292. package/src/utils/render2dGpu.ts +132 -0
  293. package/test/fixtures/gltf/animation-characterization.gltf +344 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 HypnosNova
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,30 @@
1
+ # @haiyue/extensions
2
+
3
+ Optional runtime capabilities for `@haiyue/engine`.
4
+
5
+ ## Stable entrypoints
6
+
7
+ - `@haiyue/extensions/gltf` — glTF loading, runtime components, compatibility reports, materials, and the engine plugin.
8
+ - `@haiyue/extensions/animation3d` — source-independent 3D clips, mixers, pose buffers, layers, masks, events, state machines, and the HYA adapter.
9
+ - `@haiyue/extensions/gltf-animation3d` — adapts glTF clips to the source-independent Animation3D runtime.
10
+ - `@haiyue/extensions/animation` — HYA Animation2D components, systems, loading, rendering, and state-machine integration.
11
+ - `@haiyue/extensions/hya-state-machine` — the focused HYA 2D state-machine runtime.
12
+ - `@haiyue/extensions/spine` — Spine component, render system, plugin, and the stable worker interface seam.
13
+ - `@haiyue/extensions/tilemap` — Tilemap2D component, render system, and plugin.
14
+ - `@haiyue/extensions/canvas-text` — Canvas text component and render system.
15
+ - `@haiyue/extensions/tween` — Tween2D component and update system.
16
+ - `@haiyue/extensions/grid` — Grid2D component contract.
17
+
18
+ ```ts
19
+ import { HaiyueEngine } from '@haiyue/engine';
20
+ import { createGltfPlugin } from '@haiyue/extensions/gltf';
21
+ import { Animation3DMixer } from '@haiyue/extensions/animation3d';
22
+ import { createGltfAnimation3DRuntime } from '@haiyue/extensions/gltf-animation3d';
23
+
24
+ const engine = new HaiyueEngine({ canvas: '#app' });
25
+ engine.installPlugin(createGltfPlugin());
26
+ ```
27
+
28
+ The package root remains a minimal experimental authoring base. Worker transport and low-level parsing are explicitly available from `@haiyue/extensions/experimental/gltf-worker` and `@haiyue/extensions/experimental/spine-worker`; they may change without stable-API compatibility guarantees.
29
+
30
+ WebGPU is required by the runtime; there is no WebGL fallback.
@@ -0,0 +1,46 @@
1
+ import type { AnimationSource, ParsedAnimation } from '@haiyue/animation-spec';
2
+ import { Component, type Entity, type World } from '@haiyue/engine';
3
+ import type { Animation2DRuntime } from './Animation2DRuntime';
4
+ import type { Animation2DExtensionRegistry } from './Animation2DExtensionRegistry';
5
+ export interface Animation2DComponentOptions {
6
+ autoplay?: boolean;
7
+ loop?: boolean;
8
+ speed?: number;
9
+ startTime?: number;
10
+ runtimeExtensions?: Animation2DExtensionRegistry;
11
+ }
12
+ export interface Animation2DRuntimeStats {
13
+ readonly nodeCount: number;
14
+ readonly visualCount: number;
15
+ readonly unsupportedComponentCount: number;
16
+ readonly pendingResourceCount: number;
17
+ readonly failedResourceCount: number;
18
+ readonly textCount: number;
19
+ readonly particleCount: number;
20
+ readonly audioCount: number;
21
+ }
22
+ export declare class Animation2DComponent extends Component {
23
+ static UniqueCheckType: number;
24
+ static UniqueSymbol: symbol;
25
+ static Lifecycle: number;
26
+ readonly animation: ParsedAnimation;
27
+ playing: boolean;
28
+ loop: boolean;
29
+ speed: number;
30
+ currentTime: number;
31
+ completed: boolean;
32
+ readonly runtimeExtensions: Animation2DExtensionRegistry | undefined;
33
+ _runtime: Animation2DRuntime | null;
34
+ _needsApply: boolean;
35
+ _forceParticleSeek: boolean;
36
+ constructor(source: AnimationSource | ParsedAnimation, options?: Animation2DComponentOptions);
37
+ get runtimeStats(): Animation2DRuntimeStats;
38
+ play(): this;
39
+ pause(): this;
40
+ seek(seconds: number): this;
41
+ setSpeed(speed: number): this;
42
+ onEntityRemoveComponent(_entity: Entity, component: Component): void;
43
+ onEntityRemoveFromWorld(_entity: Entity, _world: World): void;
44
+ clone(): Animation2DComponent;
45
+ _disposeRuntime(): void;
46
+ }
@@ -0,0 +1,27 @@
1
+ import type { AnimationComponent, AnimationNode, ParsedAnimation } from '@haiyue/animation-spec';
2
+ import type { Entity } from '@haiyue/engine';
3
+ export interface Animation2DExtensionContext {
4
+ readonly animation: ParsedAnimation;
5
+ readonly node: Readonly<AnimationNode>;
6
+ readonly component: Readonly<AnimationComponent>;
7
+ /** Anchor-adjusted parent for entities created by the extension. */
8
+ readonly parent: Entity;
9
+ }
10
+ export interface Animation2DExtensionInstance {
11
+ /** Deterministic composition-time update; implementations must tolerate seeks and loop wrap. */
12
+ apply?(timeSeconds: number, opacity: number): void;
13
+ setOpacity?(opacity: number): void;
14
+ destroy?(): void;
15
+ }
16
+ export interface Animation2DExtensionHandler {
17
+ /** Component type or namespaced extension id implemented by this handler. */
18
+ readonly id: string;
19
+ create(context: Animation2DExtensionContext): Animation2DExtensionInstance | void;
20
+ }
21
+ /** Instance-owned registry; unregister tokens only remove the handler that created them. */
22
+ export declare class Animation2DExtensionRegistry {
23
+ private readonly _handlers;
24
+ register(handler: Animation2DExtensionHandler): () => void;
25
+ get(id: string): Animation2DExtensionHandler | undefined;
26
+ has(id: string): boolean;
27
+ }
@@ -0,0 +1,89 @@
1
+ import { type IEngine, type RenderCommandContext } from '@haiyue/engine/extension-authoring';
2
+ import { Entity, type World } from '@haiyue/engine/ecs';
3
+ import { RenderSystem2DBase, type RenderSystem2DBaseOptions } from '../utils/RenderSystem2DBase';
4
+ export interface Animation2DRenderSystemOptions extends RenderSystem2DBaseOptions {
5
+ /** Bounds view-sized alpha targets used by masks and mattes. */
6
+ maxMaskTargets?: number;
7
+ }
8
+ export interface Animation2DRenderStats {
9
+ readonly visualCount: number;
10
+ readonly maskTargetCount: number;
11
+ readonly compositeLayerCount: number;
12
+ readonly droppedCompositeCount: number;
13
+ readonly maskPixels: number;
14
+ readonly effectTargetCount: number;
15
+ readonly droppedEffectCount: number;
16
+ /** Counts the reusable ping-pong RGBA targets owned by each active view. */
17
+ readonly effectPixels: number;
18
+ }
19
+ export declare class Animation2DRenderSystem extends RenderSystem2DBase {
20
+ private readonly maxMaskTargets;
21
+ private rendererReady;
22
+ private cameraGpu;
23
+ private objectLayout;
24
+ private textureLayout;
25
+ private compositeLayout;
26
+ private sampler;
27
+ private whiteTexture;
28
+ private whiteBindGroup;
29
+ private emptyCompositeBindGroup;
30
+ private transparentTexture;
31
+ private transparentBindGroup;
32
+ private shader;
33
+ private pipelineLayout;
34
+ private pipelines;
35
+ private readonly entityGpu;
36
+ private readonly geometryGpu;
37
+ private textureBindGroups;
38
+ private readonly maskTargets;
39
+ private readonly effectTargets;
40
+ private readonly items;
41
+ private readonly sourceItems;
42
+ private readonly sourceGroupPool;
43
+ private readonly activeMaskTargets;
44
+ private readonly compositeBindGroups;
45
+ private readonly liveGeometryIds;
46
+ private _visualCount;
47
+ private _maskTargetCount;
48
+ private _compositeLayerCount;
49
+ private _droppedCompositeCount;
50
+ private _maskPixels;
51
+ private _effectTargetCount;
52
+ private _droppedEffectCount;
53
+ private _effectPixels;
54
+ constructor(engine: IEngine, cameraEntity: Entity, options?: Animation2DRenderSystemOptions);
55
+ get stats(): Animation2DRenderStats;
56
+ get renderPipelineOptions(): {
57
+ pass: "isolated";
58
+ loadOp: "clear" | "load";
59
+ sort: number;
60
+ };
61
+ record(world: World, context: RenderCommandContext): this;
62
+ destroy(): this;
63
+ protected releaseGpuResourcesForRecovery(): void;
64
+ private prepare;
65
+ private beginMaskSegment;
66
+ private beginOutputSegment;
67
+ private getPipeline;
68
+ private getEffectPipeline;
69
+ private getPresentPipeline;
70
+ private draw;
71
+ private renderEffectStack;
72
+ private drawEffectResult;
73
+ private getEntityGpu;
74
+ private getVisualTextureBindGroup;
75
+ private getGeometryGpu;
76
+ private getTextureBindGroup;
77
+ private createTextureBindGroup;
78
+ private resolveCompositeBindGroup;
79
+ private createCompositeBindGroup;
80
+ private getMaskTarget;
81
+ private getEffectTarget;
82
+ private sweepMaskTargets;
83
+ private sweepEffectTargets;
84
+ private sweepGeometryGpu;
85
+ private destroyEntityGpu;
86
+ private destroyGeometryGpu;
87
+ private destroyMaskTarget;
88
+ private destroyEffectTarget;
89
+ }
@@ -0,0 +1,99 @@
1
+ import { type AnimationComposite, type AnimationLayerEffect, type AnimationNode, type AnimationPath2DComponent, type AnimationShape2DComponent, type AnimationSprite2DComponent, type AnimationText2DComponent, type AnimationVectorShapeComponent, type AnimationVectorValueTrack, type ParsedAnimation } from '@haiyue/animation-spec';
2
+ import { Entity, Transform2D } from '@haiyue/engine';
3
+ import { ParticleEmitter2D } from '@haiyue/engine/components';
4
+ import type { AssetManager } from '@haiyue/engine/assets';
5
+ import type { Animation2DRuntimeStats } from './Animation2DComponent.js';
6
+ import type { Animation2DExtensionInstance, Animation2DExtensionRegistry } from './Animation2DExtensionRegistry.js';
7
+ import { type VectorPathMorphComponent, type VectorStrokePathComponent } from './AnimationPathTessellator.js';
8
+ import { AnimationVisual2D } from './AnimationVisual2D.js';
9
+ import { AnimationTextRasterizer } from './AnimationTextRasterizer.js';
10
+ import { AnimationAudioClip } from './AnimationAudioClip.js';
11
+ export interface Animation2DRuntimeVisual {
12
+ readonly component: AnimationVisual2D;
13
+ readonly sourceComponentIndex: number;
14
+ readonly color: [number, number, number, number];
15
+ readonly baseAlpha: number;
16
+ lastAlpha: number;
17
+ readonly pathMorph?: VectorPathMorphComponent;
18
+ lastMorphTime?: number;
19
+ readonly vectorShape?: AnimationVectorShapeComponent;
20
+ readonly vectorPaint?: 'fill' | 'stroke';
21
+ styleAlpha: number;
22
+ lastVectorTime?: number;
23
+ readonly textRasterizer?: AnimationTextRasterizer;
24
+ readonly sourceEffects?: readonly Readonly<AnimationLayerEffect>[];
25
+ lastEffectTime?: number;
26
+ readonly compositeExpansionTracks?: readonly (Readonly<AnimationVectorValueTrack> | undefined)[];
27
+ lastCompositeTime?: number;
28
+ readonly spriteUvRectTrack?: AnimationVectorValueTrack;
29
+ spriteUvRectFrame?: number;
30
+ }
31
+ type CoreVisualComponent = AnimationShape2DComponent | AnimationPath2DComponent | AnimationSprite2DComponent | AnimationText2DComponent | AnimationVectorShapeComponent | VectorPathMorphComponent | VectorStrokePathComponent;
32
+ interface DeferredCoreVisual {
33
+ readonly component: CoreVisualComponent;
34
+ readonly componentIndex: number;
35
+ readonly order: number;
36
+ readonly sourceGroup: string | undefined;
37
+ readonly composite: Readonly<AnimationComposite> | undefined;
38
+ readonly effects: readonly Readonly<AnimationLayerEffect>[] | undefined;
39
+ }
40
+ export interface Animation2DRuntimeNode {
41
+ readonly source: Readonly<AnimationNode>;
42
+ readonly entity: Entity;
43
+ readonly content: Entity;
44
+ readonly transform: Transform2D;
45
+ readonly visuals: Animation2DRuntimeVisual[];
46
+ readonly deferredVisuals: DeferredCoreVisual[];
47
+ readonly extensions: Animation2DExtensionInstance[];
48
+ readonly particles: ParticleEmitter2D[];
49
+ readonly audio: AnimationAudioClip[];
50
+ readonly initialX: number;
51
+ readonly initialY: number;
52
+ readonly initialRotation: number;
53
+ readonly initialScaleX: number;
54
+ readonly initialScaleY: number;
55
+ readonly initialOpacity: number;
56
+ opacity: number;
57
+ }
58
+ export declare class Animation2DRuntime {
59
+ private readonly _animation;
60
+ private readonly _assetManager?;
61
+ private readonly _root;
62
+ protected readonly _nodes: Animation2DRuntimeNode[];
63
+ protected readonly _nodesById: Map<string, Animation2DRuntimeNode>;
64
+ private readonly _tracksByNode;
65
+ private readonly _trackCursors;
66
+ private readonly _trackIndices;
67
+ protected readonly _opacityMemo: Map<string, number>;
68
+ private readonly _abortController;
69
+ private readonly _assetHandles;
70
+ private readonly _fontLoads;
71
+ private readonly _fontFaces;
72
+ private readonly _instanceId;
73
+ private _visualCount;
74
+ private _unsupportedComponentCount;
75
+ private _pendingResourceCount;
76
+ private _failedResourceCount;
77
+ private _textCount;
78
+ private _particleCount;
79
+ private _audioCount;
80
+ private _destroyed;
81
+ protected _playing: boolean;
82
+ protected _speed: number;
83
+ protected _lastAppliedTime: number;
84
+ get stats(): Animation2DRuntimeStats;
85
+ constructor(owner: Entity, _animation: ParsedAnimation, runtimeExtensions?: Animation2DExtensionRegistry, _assetManager?: AssetManager | undefined);
86
+ apply(time: number, playing?: boolean, speed?: number, forceParticleSeek?: boolean): void;
87
+ destroy(): void;
88
+ setPlaying(playing: boolean): void;
89
+ private _loadTexture;
90
+ protected _materializeCoreVisual(node: Animation2DRuntimeNode, deferred: DeferredCoreVisual): void;
91
+ private _loadTextFonts;
92
+ private _loadFont;
93
+ private _applyTrack;
94
+ protected _resolveOpacity(node: Animation2DRuntimeNode): number;
95
+ protected _isNodeActive(node: Animation2DRuntimeNode): boolean;
96
+ /** @internal Applies state-machine-only component channels to the shared visual instance. */
97
+ protected _applyStateMachineVisualChannel(node: Animation2DRuntimeNode, path: string, value: unknown): boolean;
98
+ }
99
+ export {};
@@ -0,0 +1,13 @@
1
+ import type { AnimationStateMachineDefinition } from '../animation-state-machine/AnimationStateMachine.js';
2
+ import { AnimationStateMachineController, type AnimationStateMachineActionHandle, type AnimationStateMachineControllerOptions, type AnimationStateMachineMixerPort } from '../animation-state-machine/runtime/index.js';
3
+ export type Animation2DStateMachineActionHandle = AnimationStateMachineActionHandle;
4
+ export type Animation2DStateMachineMixerPort<TAction extends Animation2DStateMachineActionHandle = Animation2DStateMachineActionHandle> = AnimationStateMachineMixerPort<TAction>;
5
+ /**
6
+ * Creates a shared state-machine controller for a 2D mixer adapter.
7
+ *
8
+ * Animation2DComponent remains a single-composition player. A port must own
9
+ * the 2D pose sampling, blending, discrete-property policy, and side-effect
10
+ * lifecycle; this factory intentionally does not emulate those semantics by
11
+ * switching component timelines.
12
+ */
13
+ export declare function createAnimation2DStateMachineController<TAction extends Animation2DStateMachineActionHandle>(definition: AnimationStateMachineDefinition, port: Animation2DStateMachineMixerPort<TAction>, options?: AnimationStateMachineControllerOptions): AnimationStateMachineController<TAction>;
@@ -0,0 +1,54 @@
1
+ import { type AnimationSource, type HyaStateMachineExtension, type ParsedAnimation } from '@haiyue/animation-spec';
2
+ import { Component, type Entity, type World } from '@haiyue/engine';
3
+ import type { AnimationStateMachineLayerSnapshot } from '../animation-state-machine/runtime/index.js';
4
+ import type { AnimationStateMachineChannelDiagnostic } from '../animation-state-machine/AnimationStateMachineChannels.js';
5
+ import type { Animation2DExtensionRegistry } from './Animation2DExtensionRegistry.js';
6
+ import type { Animation2DStateMachineParameterValue, Animation2DStateMachineRuntime } from './Animation2DStateMachineRuntime.js';
7
+ import type { Animation2DRuntimeStats } from './Animation2DComponent.js';
8
+ export interface Animation2DStateMachineComponentOptions {
9
+ autoplay?: boolean;
10
+ speed?: number;
11
+ runtimeExtensions?: Animation2DExtensionRegistry;
12
+ }
13
+ /**
14
+ * Plays multiple named animation ranges and a state machine from one HYA
15
+ * asset. Transitions blend one pose onto one generated scene hierarchy.
16
+ */
17
+ export declare class Animation2DStateMachineComponent extends Component {
18
+ static UniqueCheckType: number;
19
+ static UniqueSymbol: symbol;
20
+ static Lifecycle: number;
21
+ readonly animation: ParsedAnimation;
22
+ readonly stateMachineExtension: HyaStateMachineExtension;
23
+ readonly runtimeExtensions: Animation2DExtensionRegistry | undefined;
24
+ playing: boolean;
25
+ speed: number;
26
+ _runtime: Animation2DStateMachineRuntime | null;
27
+ _needsUpdate: boolean;
28
+ private readonly _parametersByName;
29
+ private readonly _parameterValues;
30
+ constructor(source: AnimationSource | ParsedAnimation, options?: Animation2DStateMachineComponentOptions);
31
+ get runtimeStats(): Animation2DRuntimeStats;
32
+ get layerSnapshots(): readonly AnimationStateMachineLayerSnapshot[];
33
+ get channelDiagnostics(): readonly AnimationStateMachineChannelDiagnostic[];
34
+ get liveActionCount(): number;
35
+ get liveBindingCount(): number;
36
+ get sideEffectOwnerCount(): number;
37
+ play(): this;
38
+ pause(): this;
39
+ setSpeed(speed: number): this;
40
+ setFloat(name: string, value: number): this;
41
+ setInteger(name: string, value: number): this;
42
+ setBoolean(name: string, value: boolean): this;
43
+ setTrigger(name: string): this;
44
+ resetTrigger(name: string): this;
45
+ getParameter(name: string): number | boolean;
46
+ reset(): this;
47
+ onEntityRemoveComponent(_entity: Entity, component: Component): void;
48
+ onEntityRemoveFromWorld(_entity: Entity, _world: World): void;
49
+ clone(): Animation2DStateMachineComponent;
50
+ _getParameterValues(): ReadonlyMap<string, Animation2DStateMachineParameterValue>;
51
+ _disposeRuntime(): void;
52
+ private _setParameter;
53
+ private _requireParameter;
54
+ }
@@ -0,0 +1,30 @@
1
+ import type { HyaStateMachineExtension, ParsedAnimation } from '@haiyue/animation-spec';
2
+ import type { Entity } from '@haiyue/engine';
3
+ import type { AssetManager } from '@haiyue/engine/assets';
4
+ import type { AnimationStateMachineController, AnimationStateMachineLayerSnapshot } from '../animation-state-machine/runtime/index.js';
5
+ import { type Animation2DStateMachineActionRuntimeHandle } from '../animation-state-machine/runtime/index.js';
6
+ import type { AnimationStateMachineChannelDiagnostic } from '../animation-state-machine/AnimationStateMachineChannels.js';
7
+ import type { Animation2DExtensionRegistry } from './Animation2DExtensionRegistry.js';
8
+ import type { Animation2DRuntimeStats } from './Animation2DComponent.js';
9
+ export type Animation2DStateMachineParameterValue = number | boolean;
10
+ export declare class Animation2DStateMachineRuntime {
11
+ readonly extension: HyaStateMachineExtension;
12
+ private readonly _mixer;
13
+ private readonly _adapter;
14
+ private readonly _pose;
15
+ private readonly _visual;
16
+ private _destroyed;
17
+ readonly controller: AnimationStateMachineController<Animation2DStateMachineActionRuntimeHandle>;
18
+ constructor(owner: Entity, animation: ParsedAnimation, extension: HyaStateMachineExtension, parameterValues: ReadonlyMap<string, Animation2DStateMachineParameterValue>, runtimeExtensions?: Animation2DExtensionRegistry, assetManager?: AssetManager);
19
+ get stats(): Animation2DRuntimeStats;
20
+ get diagnostics(): readonly AnimationStateMachineChannelDiagnostic[];
21
+ get liveActionCount(): number;
22
+ get liveBindingCount(): number;
23
+ get sideEffectOwnerCount(): number;
24
+ get layerSnapshots(): readonly AnimationStateMachineLayerSnapshot[];
25
+ update(deltaSeconds: number, playing: boolean, speed: number): void;
26
+ setPlaying(playing: boolean): void;
27
+ reset(): void;
28
+ destroy(): void;
29
+ private _requireActive;
30
+ }
@@ -0,0 +1,14 @@
1
+ import { System, type World } from '@haiyue/engine';
2
+ import type { AssetManager } from '@haiyue/engine/assets';
3
+ export interface Animation2DStateMachineSystemOptions {
4
+ priority?: number;
5
+ /** Shared engine asset manager used by sprite2d resources. */
6
+ assetManager?: AssetManager;
7
+ }
8
+ export declare class Animation2DStateMachineSystem extends System {
9
+ private readonly _assetManager;
10
+ constructor(options?: Animation2DStateMachineSystemOptions);
11
+ update(world: World, _time: number, delta: number): this;
12
+ destroy(): this;
13
+ private _updateEntity;
14
+ }
@@ -0,0 +1,27 @@
1
+ import type { Entity } from '@haiyue/engine';
2
+ import type { AssetManager } from '@haiyue/engine/assets';
3
+ import type { ParsedAnimation } from '@haiyue/animation-spec';
4
+ import type { Animation2DExtensionRegistry } from './Animation2DExtensionRegistry.js';
5
+ import { Animation2DRuntime } from './Animation2DRuntime.js';
6
+ import type { Animation2DPose } from './runtime/mixer/index.js';
7
+ import { type AnimationStateMachineChannelDiagnostic } from '../animation-state-machine/AnimationStateMachineChannels.js';
8
+ /** State-machine-only pose writer kept out of the ordinary Animation2D bundle. */
9
+ export declare class Animation2DStateMachineVisualRuntime extends Animation2DRuntime {
10
+ private readonly _particleOwners;
11
+ private readonly _audioOwners;
12
+ private readonly _effectPayloads;
13
+ private readonly _diagnostics;
14
+ private readonly _reportedAudioRejections;
15
+ constructor(owner: Entity, animation: ParsedAnimation, runtimeExtensions?: Animation2DExtensionRegistry, assetManager?: AssetManager);
16
+ get diagnostics(): readonly AnimationStateMachineChannelDiagnostic[];
17
+ get sideEffectOwnerCount(): number;
18
+ resetSideEffects(): void;
19
+ applyPose(pose: Animation2DPose, playing?: boolean, speed?: number): void;
20
+ setPlaying(playing: boolean): void;
21
+ destroy(): void;
22
+ private _applyVisualOpacity;
23
+ private _applyEffect;
24
+ private _particleTarget;
25
+ private _audioTarget;
26
+ private _reportAudioRejection;
27
+ }
@@ -0,0 +1,14 @@
1
+ import { System, type World } from '@haiyue/engine';
2
+ import type { AssetManager } from '@haiyue/engine/assets';
3
+ export interface Animation2DSystemOptions {
4
+ priority?: number;
5
+ /** Shared engine asset manager used by sprite2d resources. */
6
+ assetManager?: AssetManager;
7
+ }
8
+ export declare class Animation2DSystem extends System {
9
+ private readonly _assetManager;
10
+ constructor(options?: Animation2DSystemOptions);
11
+ update(world: World, _time: number, delta: number): this;
12
+ destroy(): this;
13
+ private _updateEntity;
14
+ }
@@ -0,0 +1,9 @@
1
+ import { type AnimationParseOptions, type ParsedAnimation } from '@haiyue/animation-spec';
2
+ import type { AssetLoaderRegistration } from '@haiyue/engine/assets';
3
+ export declare const HAIYUE_ANIMATION_ASSET_TYPE: "animation/haiyue";
4
+ export interface AnimationAssetLoaderOptions {
5
+ parse?: AnimationParseOptions;
6
+ fetch?: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
7
+ }
8
+ /** Creates an AssetManager loader without installing source-format converters in the runtime. */
9
+ export declare function createAnimationAssetLoader(options?: AnimationAssetLoaderOptions): AssetLoaderRegistration<ParsedAnimation>;
@@ -0,0 +1,26 @@
1
+ import type { AnimationAudioComponent, AnimationNode } from '@haiyue/animation-spec';
2
+ /** HTML media-backed audio clip with composition-time seek and playback-rate synchronization. */
3
+ export declare class AnimationAudioClip {
4
+ private readonly element;
5
+ private readonly nodeStart;
6
+ private readonly nodeEnd;
7
+ private readonly startOffset;
8
+ private readonly baseVolume;
9
+ private readonly clipRate;
10
+ private readonly loop;
11
+ private playPending;
12
+ private destroyed;
13
+ private stateMachineActive;
14
+ private playRequestEpoch;
15
+ constructor(uri: string, component: AnimationAudioComponent, node: Readonly<AnimationNode>, animationDuration: number);
16
+ sync(compositionTime: number, playing: boolean, speed: number, opacity: number): void;
17
+ enterStateMachine(playing: boolean, speed: number, opacity: number, rejected: (reason: unknown) => void): void;
18
+ restartStateMachine(playing: boolean, speed: number, opacity: number, rejected: (reason: unknown) => void): void;
19
+ setStateMachinePlaying(playing: boolean, speed: number, rejected: (reason: unknown) => void): void;
20
+ updateStateMachineProperties(speed: number, opacity: number): void;
21
+ exitStateMachine(): void;
22
+ pause(): void;
23
+ destroy(): void;
24
+ private _requestPlay;
25
+ private _cancelPendingPlay;
26
+ }
@@ -0,0 +1,52 @@
1
+ import type { AnimationPath2DComponent } from '@haiyue/animation-spec';
2
+ import { Geometry2D } from '@haiyue/engine';
3
+ export type ResolvedVectorPathModifier = Readonly<{
4
+ kind: 'trim-path';
5
+ start: number;
6
+ end: number;
7
+ offset: number;
8
+ mode: 'simultaneous' | 'individual';
9
+ }> | Readonly<{
10
+ kind: 'round-corners';
11
+ radius: number;
12
+ }>;
13
+ export interface ResolvedVectorPath {
14
+ readonly commands: string;
15
+ readonly values: Float32Array;
16
+ }
17
+ export interface VectorStrokePathComponent {
18
+ readonly [key: string]: unknown;
19
+ readonly type: 'org.haiyue.vector-stroke@1';
20
+ readonly commands?: string;
21
+ readonly values?: readonly number[] | Float32Array;
22
+ readonly sourceComponent?: number;
23
+ readonly color: readonly [number, number, number, number];
24
+ readonly width: number;
25
+ readonly lineCap: 'butt' | 'round' | 'square';
26
+ readonly lineJoin: 'miter' | 'round' | 'bevel';
27
+ readonly miterLimit: number;
28
+ readonly dash?: readonly number[] | Float32Array;
29
+ readonly dashOffset?: number;
30
+ readonly tolerance?: number;
31
+ }
32
+ export interface VectorPathMorphComponent {
33
+ readonly [key: string]: unknown;
34
+ readonly type: 'org.haiyue.vector-path-morph@1';
35
+ readonly commands: string;
36
+ readonly times: readonly number[] | Float32Array;
37
+ readonly values: readonly number[] | Float32Array;
38
+ readonly valueSize: number;
39
+ readonly interpolation: 'step' | 'linear' | 'cubic-bezier';
40
+ readonly easings?: readonly number[] | Float32Array;
41
+ readonly fill: readonly [number, number, number, number];
42
+ readonly fillRule: 'nonzero' | 'evenodd';
43
+ readonly tolerance?: number;
44
+ }
45
+ /** Applies ordered source-neutral modifiers after curve flattening. Empty trim ranges return an empty command stream. */
46
+ export declare function applyVectorPathModifiers(commands: string, values: readonly number[] | Float32Array, tolerance: number, modifiers: readonly ResolvedVectorPathModifier[], closeOpen: boolean): ResolvedVectorPath;
47
+ /** Flattens packed quadratic/cubic commands and triangulates contours with hole nesting. */
48
+ export declare function tessellateAnimationPath(component: AnimationPath2DComponent): Geometry2D;
49
+ /** Tessellates the compact Lottie stroke extension without expanding it in the HYA payload. */
50
+ export declare function tessellateVectorStrokePath(component: VectorStrokePathComponent, allowEmpty?: boolean): Geometry2D;
51
+ /** Samples a topology-stable Lottie path morph into the ordinary path tessellator ABI. */
52
+ export declare function sampleVectorPathMorph(component: VectorPathMorphComponent, time: number): AnimationPath2DComponent;
@@ -0,0 +1,21 @@
1
+ import type { AnimationText2DComponent } from '@haiyue/animation-spec';
2
+ type TextTexture = HTMLCanvasElement | ImageBitmap;
3
+ /** Runtime-private deterministic grapheme shaper and Canvas atlas uploader. */
4
+ export declare class AnimationTextRasterizer {
5
+ readonly component: Readonly<AnimationText2DComponent>;
6
+ texture: TextTexture | null;
7
+ textureVersion: number;
8
+ private readonly canvas;
9
+ private time;
10
+ private dirty;
11
+ private updating;
12
+ private updateToken;
13
+ private readonly animated;
14
+ constructor(component: Readonly<AnimationText2DComponent>);
15
+ setTime(time: number): void;
16
+ invalidateFont(): void;
17
+ destroy(): void;
18
+ updateTexture(): Promise<void>;
19
+ private draw;
20
+ }
21
+ export {};
@@ -0,0 +1,68 @@
1
+ import type { AnimationComposite, AnimationCompositeLayer, AnimationCompositeMode } from '@haiyue/animation-spec';
2
+ import { Component, Geometry2D } from '@haiyue/engine';
3
+ import type { AssetHandle } from '@haiyue/engine/assets';
4
+ import type { AnimationTextRasterizer } from './AnimationTextRasterizer';
5
+ export interface AnimationVisual2DOptions {
6
+ geometry: Geometry2D;
7
+ color: readonly [number, number, number, number];
8
+ instanceId: number;
9
+ nodeId: string;
10
+ order: number;
11
+ sourceOnly?: boolean;
12
+ composite?: Readonly<AnimationComposite>;
13
+ texture?: GPUTexture | null;
14
+ textureHandle?: AssetHandle<GPUTexture> | null;
15
+ textMaterial?: AnimationTextRasterizer | null;
16
+ /** Keeps sprites invisible until their asynchronous texture is ready. */
17
+ requiresTexture?: boolean;
18
+ uvRect?: readonly [number, number, number, number];
19
+ gradient?: AnimationVisualGradient | null;
20
+ effects?: readonly AnimationVisualEffect[];
21
+ }
22
+ export interface AnimationVisualGradient {
23
+ kind: 'linear' | 'radial';
24
+ start: [number, number];
25
+ end: [number, number];
26
+ /** Mutable packed offset,r,g,b,a tuples, bounded to eight stops. */
27
+ stops: Float32Array;
28
+ opacity: number;
29
+ }
30
+ export type AnimationVisualEffectKind = 'tint' | 'fill' | 'opacity' | 'color-matrix' | 'blur' | 'drop-shadow';
31
+ export interface AnimationVisualEffect {
32
+ readonly kind: AnimationVisualEffectKind;
33
+ /** Mutable, kind-specific sampled values owned by the animation runtime. */
34
+ readonly values: Float32Array;
35
+ }
36
+ /** Runtime-private render item consumed by Animation2DRenderSystem. */
37
+ export declare class AnimationVisual2D extends Component {
38
+ static UniqueCheckType: number;
39
+ static UniqueSymbol: symbol;
40
+ readonly geometry: Geometry2D;
41
+ readonly instanceId: number;
42
+ readonly nodeId: string;
43
+ readonly nodeKey: string;
44
+ readonly order: number;
45
+ readonly sourceOnly: boolean;
46
+ readonly compositeLayers: readonly Readonly<AnimationCompositeLayer>[];
47
+ readonly compositeKeys: readonly string[];
48
+ /** Compatibility accessors for single-layer renderer diagnostics. */
49
+ readonly compositeSource: string | undefined;
50
+ readonly compositeKey: string | undefined;
51
+ readonly compositeMode: AnimationCompositeMode | undefined;
52
+ readonly uvRect: [number, number, number, number];
53
+ readonly color: [number, number, number, number];
54
+ texture: GPUTexture | null;
55
+ textureHandle: AssetHandle<GPUTexture> | null;
56
+ readonly textMaterial: AnimationTextRasterizer | null;
57
+ readonly requiresTexture: boolean;
58
+ gradient: AnimationVisualGradient | null;
59
+ readonly effects: readonly AnimationVisualEffect[];
60
+ revision: number;
61
+ constructor(options: AnimationVisual2DOptions);
62
+ setTexture(texture: GPUTexture | null): void;
63
+ setTextureHandle(handle: AssetHandle<GPUTexture> | null): void;
64
+ setUvRect(value: readonly [number, number, number, number]): void;
65
+ setCompositeExpansion(index: number, value: number): void;
66
+ resolveTexture(): GPUTexture | null;
67
+ clone(): AnimationVisual2D;
68
+ }