@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.
- package/LICENSE +21 -0
- package/README.md +30 -0
- package/dist/animation/Animation2DComponent.d.ts +46 -0
- package/dist/animation/Animation2DExtensionRegistry.d.ts +27 -0
- package/dist/animation/Animation2DRenderSystem.d.ts +89 -0
- package/dist/animation/Animation2DRuntime.d.ts +99 -0
- package/dist/animation/Animation2DStateMachine.d.ts +13 -0
- package/dist/animation/Animation2DStateMachineComponent.d.ts +54 -0
- package/dist/animation/Animation2DStateMachineRuntime.d.ts +30 -0
- package/dist/animation/Animation2DStateMachineSystem.d.ts +14 -0
- package/dist/animation/Animation2DStateMachineVisualRuntime.d.ts +27 -0
- package/dist/animation/Animation2DSystem.d.ts +14 -0
- package/dist/animation/AnimationAssetLoader.d.ts +9 -0
- package/dist/animation/AnimationAudioClip.d.ts +26 -0
- package/dist/animation/AnimationPathTessellator.d.ts +52 -0
- package/dist/animation/AnimationTextRasterizer.d.ts +21 -0
- package/dist/animation/AnimationVisual2D.d.ts +68 -0
- package/dist/animation/HyaAnimation2DClipAdapter.d.ts +16 -0
- package/dist/animation/Particle2DDescriptorAdapter.d.ts +5 -0
- package/dist/animation/runtime/mixer/Action.d.ts +150 -0
- package/dist/animation/runtime/mixer/Mixer.d.ts +54 -0
- package/dist/animation/runtime/mixer/PoseBuffer.d.ts +23 -0
- package/dist/animation/runtime/mixer/Sampler.d.ts +17 -0
- package/dist/animation/runtime/mixer/Types.d.ts +101 -0
- package/dist/animation/runtime/mixer/index.d.ts +6 -0
- package/dist/animation-state-machine/AnimationStateMachine.d.ts +111 -0
- package/dist/animation-state-machine/AnimationStateMachineChannels.d.ts +23 -0
- package/dist/animation-state-machine/runtime/Animation2DStateMachineMixerAdapter.d.ts +51 -0
- package/dist/animation-state-machine/runtime/AnimationStateMachineBlendTreeWeights.d.ts +14 -0
- package/dist/animation-state-machine/runtime/AnimationStateMachineCompiler.d.ts +109 -0
- package/dist/animation-state-machine/runtime/AnimationStateMachineController.d.ts +103 -0
- package/dist/animation-state-machine/runtime/AnimationStateMachineMixerPort.d.ts +35 -0
- package/dist/animation-state-machine/runtime/index.d.ts +7 -0
- package/dist/animation.d.ts +15 -0
- package/dist/animation.js +1171 -0
- package/dist/animation3d/Animation3DAction.d.ts +46 -0
- package/dist/animation3d/Animation3DBinding.d.ts +85 -0
- package/dist/animation3d/Animation3DClip.d.ts +20 -0
- package/dist/animation3d/Animation3DError.d.ts +13 -0
- package/dist/animation3d/Animation3DMixer.d.ts +27 -0
- package/dist/animation3d/Animation3DPose.d.ts +40 -0
- package/dist/animation3d/Animation3DPoseBuffer.d.ts +24 -0
- package/dist/animation3d/Animation3DResource.d.ts +28 -0
- package/dist/animation3d/Animation3DStateMachine.d.ts +95 -0
- package/dist/animation3d/Animation3DStateMachineRuntime.d.ts +70 -0
- package/dist/animation3d/Animation3DTrack.d.ts +19 -0
- package/dist/animation3d/hya/HyaAnimation3DRuntime.d.ts +73 -0
- package/dist/animation3d/hya/HyaAnimation3DStateMachineRuntime.d.ts +65 -0
- package/dist/animation3d/hya/HyaAnimation3DTypes.d.ts +170 -0
- package/dist/animation3d/hya/index.d.ts +4 -0
- package/dist/animation3d/index.d.ts +14 -0
- package/dist/animation3d/runtime/integration/Animation3DStateMachineMixerAdapter.d.ts +81 -0
- package/dist/animation3d/runtime/integration/Animation3DStateMachineMixerIntegration.d.ts +39 -0
- package/dist/animation3d/runtime/integration/index.d.ts +2 -0
- package/dist/animation3d/runtime/mixer/Action.d.ts +150 -0
- package/dist/animation3d/runtime/mixer/Animation3DMixerRuntimeStore.d.ts +6 -0
- package/dist/animation3d/runtime/mixer/Mixer.d.ts +59 -0
- package/dist/animation3d/runtime/mixer/PoseBuffer.d.ts +1 -0
- package/dist/animation3d/runtime/mixer/TrackSampler.d.ts +24 -0
- package/dist/animation3d/runtime/mixer/index.d.ts +4 -0
- package/dist/animation3d/runtime/state-machine/Animation3DBlendTreeWeights.d.ts +1 -0
- package/dist/animation3d/runtime/state-machine/Animation3DStateMachineCompiler.d.ts +1 -0
- package/dist/animation3d/runtime/state-machine/Animation3DStateMachineController.d.ts +1 -0
- package/dist/animation3d/runtime/state-machine/Animation3DStateMachineMixerPort.d.ts +1 -0
- package/dist/animation3d/runtime/state-machine/index.d.ts +6 -0
- package/dist/animation3d.d.ts +5 -0
- package/dist/animation3d.js +1708 -0
- package/dist/benchmark.d.ts +30 -0
- package/dist/benchmark.js +119 -0
- package/dist/canvas-text/CanvasText2DRenderSystem.d.ts +24 -0
- package/dist/canvas-text/CanvasTextComponent.d.ts +18 -0
- package/dist/canvas-text.d.ts +4 -0
- package/dist/canvas-text.js +276 -0
- package/dist/chunks/2d-ui-animation-2d.generated-D4aHzFU2.js +4 -0
- package/dist/chunks/2d-ui-canvas-text-2d.generated-C0Eaej2m.js +4 -0
- package/dist/chunks/2d-ui-spine2d.generated-CUUi8xjl.js +4 -0
- package/dist/chunks/2d-ui-tilemap2d.generated-gebw4mX7.js +4 -0
- package/dist/chunks/Animation2DStateMachine-9IonguNa.js +3245 -0
- package/dist/chunks/AnimationStateMachineController-BIcAh-sT.js +1438 -0
- package/dist/chunks/GltfAnimation3DAdapter-Cu3rQQsW.js +2240 -0
- package/dist/chunks/GltfAnimationRuntime-CRHsLycN.js +631 -0
- package/dist/chunks/RenderSystem2DBase-DDT61dAu.js +227 -0
- package/dist/chunks/Spine2DRuntime-D9M9LAQR.js +3056 -0
- package/dist/chunks/SpineAssetParser-BSDmPge1.js +378 -0
- package/dist/chunks/gltfLoader-Dm22jLYB.js +2085 -0
- package/dist/chunks/pluginUtils-CvwroRMd.js +33 -0
- package/dist/experimental-gltf-worker.d.ts +4 -0
- package/dist/experimental-gltf-worker.js +138 -0
- package/dist/experimental-spine-worker.d.ts +4 -0
- package/dist/experimental-spine-worker.js +110 -0
- package/dist/gltf/GltfAccessorReader.d.ts +7 -0
- package/dist/gltf/GltfAnimation3DAdapter.d.ts +47 -0
- package/dist/gltf/GltfAnimationRuntime.d.ts +10 -0
- package/dist/gltf/GltfAssetWorkerClient.d.ts +20 -0
- package/dist/gltf/GltfCompatibilityReport.d.ts +70 -0
- package/dist/gltf/GltfConservativeBounds.d.ts +18 -0
- package/dist/gltf/GltfDracoDecoder.d.ts +4 -0
- package/dist/gltf/GltfExtensionAdapter.d.ts +54 -0
- package/dist/gltf/GltfLoaderContract.d.ts +249 -0
- package/dist/gltf/GltfLoaderErrors.d.ts +4 -0
- package/dist/gltf/GltfMaterialDescriptor.d.ts +23 -0
- package/dist/gltf/GltfMaterialEncoder.d.ts +20 -0
- package/dist/gltf/GltfMaterialLoader.d.ts +6 -0
- package/dist/gltf/GltfModelComponent.d.ts +72 -0
- package/dist/gltf/GltfModelSystem.d.ts +37 -0
- package/dist/gltf/GltfPlugin.d.ts +6 -0
- package/dist/gltf/GltfSchema.d.ts +225 -0
- package/dist/gltf/GltfUvSemanticPlanner.d.ts +33 -0
- package/dist/gltf/gltfLoader.d.ts +9 -0
- package/dist/gltf-animation3d.d.ts +3 -0
- package/dist/gltf-animation3d.js +8 -0
- package/dist/gltf-worker-runtime.d.ts +7 -0
- package/dist/gltf-worker-runtime.js +6981 -0
- package/dist/gltf.d.ts +12 -0
- package/dist/gltf.js +517 -0
- package/dist/grid/Grid2DComponent.d.ts +25 -0
- package/dist/grid.d.ts +2 -0
- package/dist/grid.js +56 -0
- package/dist/hya-state-machine.d.ts +7 -0
- package/dist/hya-state-machine.js +2934 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +7 -0
- package/dist/internal/2d-ui-shader-artifact.js +870 -0
- package/dist/plugins/pluginUtils.d.ts +20 -0
- package/dist/plugins.d.ts +6 -0
- package/dist/shaders/generated/2d-ui-artifact.generated.d.ts +658 -0
- package/dist/spine/Spine2DComponent.d.ts +116 -0
- package/dist/spine/Spine2DGpuRenderer.d.ts +65 -0
- package/dist/spine/Spine2DRenderSystem.d.ts +27 -0
- package/dist/spine/Spine2DRuntime.d.ts +103 -0
- package/dist/spine/SpineAnimationBoneTimelines.d.ts +8 -0
- package/dist/spine/SpineAssetParser.d.ts +18 -0
- package/dist/spine/SpineAssetWorkerClient.d.ts +19 -0
- package/dist/spine/SpineAssetWorkerContract.d.ts +6 -0
- package/dist/spine/SpineAtlasParser.d.ts +21 -0
- package/dist/spine/SpineFloatBuilder.d.ts +15 -0
- package/dist/spine/SpinePathConstraintSolver.d.ts +32 -0
- package/dist/spine/SpinePlugin.d.ts +8 -0
- package/dist/spine/SpineSkeletonRuntime.d.ts +185 -0
- package/dist/spine/SpineSlotAnimation.d.ts +17 -0
- package/dist/spine/SpineTimelineRuntime.d.ts +25 -0
- package/dist/spine/SpineVertexBuilder.d.ts +61 -0
- package/dist/spine.d.ts +7 -0
- package/dist/spine.js +578 -0
- package/dist/tilemap/Tilemap2DComponent.d.ts +110 -0
- package/dist/tilemap/Tilemap2DRenderSystem.d.ts +11 -0
- package/dist/tilemap/Tilemap2DRenderer.d.ts +24 -0
- package/dist/tilemap/TilemapPlugin.d.ts +8 -0
- package/dist/tilemap.d.ts +6 -0
- package/dist/tilemap.js +535 -0
- package/dist/tween/Tween2DComponent.d.ts +70 -0
- package/dist/tween/Tween2DSystem.d.ts +12 -0
- package/dist/tween.d.ts +4 -0
- package/dist/tween.js +138 -0
- package/dist/utils/RenderSystem2DBase.d.ts +42 -0
- package/dist/utils/arrayAccess.d.ts +4 -0
- package/dist/utils/camera2d.d.ts +12 -0
- package/dist/utils/render2dGpu.d.ts +32 -0
- package/package.json +124 -0
- package/src/animation/Animation2DComponent.ts +135 -0
- package/src/animation/Animation2DExtensionRegistry.ts +52 -0
- package/src/animation/Animation2DRenderSystem.ts +1026 -0
- package/src/animation/Animation2DRuntime.ts +1326 -0
- package/src/animation/Animation2DStateMachine.ts +39 -0
- package/src/animation/Animation2DStateMachineComponent.ts +228 -0
- package/src/animation/Animation2DStateMachineRuntime.ts +141 -0
- package/src/animation/Animation2DStateMachineSystem.ts +60 -0
- package/src/animation/Animation2DStateMachineVisualRuntime.ts +282 -0
- package/src/animation/Animation2DSystem.ts +72 -0
- package/src/animation/AnimationAssetLoader.ts +84 -0
- package/src/animation/AnimationAudioClip.ts +140 -0
- package/src/animation/AnimationPathTessellator.ts +691 -0
- package/src/animation/AnimationTextRasterizer.ts +340 -0
- package/src/animation/AnimationVisual2D.ts +153 -0
- package/src/animation/HyaAnimation2DClipAdapter.ts +845 -0
- package/src/animation/Particle2DDescriptorAdapter.ts +35 -0
- package/src/animation/runtime/mixer/Action.ts +876 -0
- package/src/animation/runtime/mixer/Mixer.ts +505 -0
- package/src/animation/runtime/mixer/PoseBuffer.ts +105 -0
- package/src/animation/runtime/mixer/Sampler.ts +252 -0
- package/src/animation/runtime/mixer/Types.ts +138 -0
- package/src/animation/runtime/mixer/index.ts +31 -0
- package/src/animation-state-machine/AnimationStateMachine.ts +146 -0
- package/src/animation-state-machine/AnimationStateMachineChannels.ts +116 -0
- package/src/animation-state-machine/runtime/Animation2DStateMachineMixerAdapter.ts +197 -0
- package/src/animation-state-machine/runtime/AnimationStateMachineBlendTreeWeights.ts +503 -0
- package/src/animation-state-machine/runtime/AnimationStateMachineCompiler.ts +763 -0
- package/src/animation-state-machine/runtime/AnimationStateMachineController.ts +987 -0
- package/src/animation-state-machine/runtime/AnimationStateMachineMixerPort.ts +54 -0
- package/src/animation-state-machine/runtime/index.ts +47 -0
- package/src/animation.ts +33 -0
- package/src/animation3d/Animation3DAction.ts +73 -0
- package/src/animation3d/Animation3DBinding.ts +116 -0
- package/src/animation3d/Animation3DClip.ts +22 -0
- package/src/animation3d/Animation3DError.ts +34 -0
- package/src/animation3d/Animation3DMixer.ts +82 -0
- package/src/animation3d/Animation3DPose.ts +100 -0
- package/src/animation3d/Animation3DPoseBuffer.ts +85 -0
- package/src/animation3d/Animation3DResource.ts +49 -0
- package/src/animation3d/Animation3DStateMachine.ts +126 -0
- package/src/animation3d/Animation3DStateMachineRuntime.ts +191 -0
- package/src/animation3d/Animation3DTrack.ts +29 -0
- package/src/animation3d/hya/HyaAnimation3DRuntime.ts +756 -0
- package/src/animation3d/hya/HyaAnimation3DStateMachineRuntime.ts +618 -0
- package/src/animation3d/hya/HyaAnimation3DTypes.ts +168 -0
- package/src/animation3d/hya/index.ts +10 -0
- package/src/animation3d/index.ts +76 -0
- package/src/animation3d/runtime/integration/Animation3DStateMachineMixerAdapter.ts +325 -0
- package/src/animation3d/runtime/integration/Animation3DStateMachineMixerIntegration.ts +158 -0
- package/src/animation3d/runtime/integration/index.ts +9 -0
- package/src/animation3d/runtime/mixer/Action.ts +833 -0
- package/src/animation3d/runtime/mixer/Animation3DMixerRuntimeStore.ts +26 -0
- package/src/animation3d/runtime/mixer/Mixer.ts +562 -0
- package/src/animation3d/runtime/mixer/PoseBuffer.ts +1 -0
- package/src/animation3d/runtime/mixer/TrackSampler.ts +399 -0
- package/src/animation3d/runtime/mixer/index.ts +8 -0
- package/src/animation3d/runtime/state-machine/Animation3DBlendTreeWeights.ts +4 -0
- package/src/animation3d/runtime/state-machine/Animation3DStateMachineCompiler.ts +1 -0
- package/src/animation3d/runtime/state-machine/Animation3DStateMachineController.ts +1 -0
- package/src/animation3d/runtime/state-machine/Animation3DStateMachineMixerPort.ts +1 -0
- package/src/animation3d/runtime/state-machine/index.ts +45 -0
- package/src/animation3d.ts +5 -0
- package/src/benchmark.ts +168 -0
- package/src/canvas-text/CanvasText2DRenderSystem.ts +292 -0
- package/src/canvas-text/CanvasTextComponent.ts +47 -0
- package/src/canvas-text.ts +4 -0
- package/src/experimental-gltf-worker.ts +18 -0
- package/src/experimental-spine-worker.ts +9 -0
- package/src/gltf/GltfAccessorReader.ts +271 -0
- package/src/gltf/GltfAnimation3DAdapter.ts +680 -0
- package/src/gltf/GltfAnimationRuntime.ts +392 -0
- package/src/gltf/GltfAssetWorkerClient.ts +136 -0
- package/src/gltf/GltfCompatibilityReport.ts +214 -0
- package/src/gltf/GltfConservativeBounds.ts +219 -0
- package/src/gltf/GltfDracoDecoder.ts +251 -0
- package/src/gltf/GltfExtensionAdapter.ts +340 -0
- package/src/gltf/GltfLoaderContract.ts +333 -0
- package/src/gltf/GltfLoaderErrors.ts +59 -0
- package/src/gltf/GltfMaterialDescriptor.ts +134 -0
- package/src/gltf/GltfMaterialEncoder.ts +173 -0
- package/src/gltf/GltfMaterialLoader.ts +293 -0
- package/src/gltf/GltfModelComponent.ts +115 -0
- package/src/gltf/GltfModelSystem.ts +208 -0
- package/src/gltf/GltfPlugin.ts +84 -0
- package/src/gltf/GltfSchema.ts +229 -0
- package/src/gltf/GltfUvSemanticPlanner.ts +166 -0
- package/src/gltf/gltfLoader.ts +910 -0
- package/src/gltf-animation3d.ts +10 -0
- package/src/gltf-worker-runtime.ts +10 -0
- package/src/gltf.ts +56 -0
- package/src/grid/Grid2DComponent.ts +69 -0
- package/src/grid.ts +2 -0
- package/src/hya-state-machine.ts +19 -0
- package/src/index.ts +2 -0
- package/src/plugins/pluginUtils.ts +50 -0
- package/src/plugins.ts +6 -0
- package/src/shaders/generated/2d-ui-animation-2d.generated.wgsl +242 -0
- package/src/shaders/generated/2d-ui-artifact.generated.ts +867 -0
- package/src/shaders/generated/2d-ui-canvas-text-2d.generated.wgsl +38 -0
- package/src/shaders/generated/2d-ui-spine2d.generated.wgsl +41 -0
- package/src/shaders/generated/2d-ui-tilemap2d.generated.wgsl +36 -0
- package/src/spine/Spine2DComponent.ts +168 -0
- package/src/spine/Spine2DGpuRenderer.ts +449 -0
- package/src/spine/Spine2DRenderSystem.ts +199 -0
- package/src/spine/Spine2DRuntime.ts +1529 -0
- package/src/spine/SpineAnimationBoneTimelines.ts +30 -0
- package/src/spine/SpineAssetParser.ts +20 -0
- package/src/spine/SpineAssetWorkerClient.ts +112 -0
- package/src/spine/SpineAssetWorkerContract.ts +4 -0
- package/src/spine/SpineAtlasParser.ts +127 -0
- package/src/spine/SpineFloatBuilder.ts +66 -0
- package/src/spine/SpinePathConstraintSolver.ts +582 -0
- package/src/spine/SpinePlugin.ts +76 -0
- package/src/spine/SpineSkeletonRuntime.ts +521 -0
- package/src/spine/SpineSlotAnimation.ts +195 -0
- package/src/spine/SpineTimelineRuntime.ts +453 -0
- package/src/spine/SpineVertexBuilder.ts +686 -0
- package/src/spine.ts +7 -0
- package/src/tilemap/Tilemap2DComponent.ts +232 -0
- package/src/tilemap/Tilemap2DRenderSystem.ts +58 -0
- package/src/tilemap/Tilemap2DRenderer.ts +289 -0
- package/src/tilemap/TilemapPlugin.ts +75 -0
- package/src/tilemap.ts +6 -0
- package/src/tween/Tween2DComponent.ts +83 -0
- package/src/tween/Tween2DSystem.ts +78 -0
- package/src/tween.ts +4 -0
- package/src/types/earcut.d.ts +7 -0
- package/src/types/wgsl.d.ts +4 -0
- package/src/utils/RenderSystem2DBase.ts +164 -0
- package/src/utils/arrayAccess.ts +17 -0
- package/src/utils/camera2d.ts +68 -0
- package/src/utils/render2dGpu.ts +132 -0
- package/test/fixtures/gltf/animation-characterization.gltf +344 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type AnimationAudioComponent, type AnimationParticle2DComponent, type HyaStateMachineExtension, type ParsedAnimation } from '@haiyue/animation-spec';
|
|
2
|
+
import type { Animation2DClip } from './runtime/mixer/index.js';
|
|
3
|
+
/** Returns the canonical built-in state-machine payload from a parsed HYA document. */
|
|
4
|
+
export declare function getHyaStateMachineExtension(animation: ParsedAnimation): HyaStateMachineExtension;
|
|
5
|
+
/**
|
|
6
|
+
* Adapts named ranges from one HYA composition into source-independent 2D
|
|
7
|
+
* clips. The returned clips share no scene objects; one pose is applied to one
|
|
8
|
+
* Animation2DRuntime hierarchy by the state-machine runtime.
|
|
9
|
+
*/
|
|
10
|
+
export declare function createHyaAnimation2DClips(animation: ParsedAnimation, extension?: HyaStateMachineExtension): readonly Animation2DClip[];
|
|
11
|
+
export interface HyaAnimation2DEffectPayload {
|
|
12
|
+
readonly targetId: string;
|
|
13
|
+
readonly slot: number;
|
|
14
|
+
readonly sourcePath: string;
|
|
15
|
+
readonly component: Readonly<AnimationParticle2DComponent | AnimationAudioComponent>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { AnimationParticle2DComponent } from '@haiyue/animation-spec';
|
|
2
|
+
import { ParticleEmitter2D, type ParticleEmitter2DOptions } from '@haiyue/engine/components';
|
|
3
|
+
/** Single runtime mapping from screen-y-down HYA data to the engine's y-up emitter. */
|
|
4
|
+
export declare function particle2DDescriptorToEmitterOptions(component: Readonly<AnimationParticle2DComponent>): ParticleEmitter2DOptions;
|
|
5
|
+
export declare function createParticle2DEmitter(component: Readonly<AnimationParticle2DComponent>): ParticleEmitter2D;
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import type { Animation2DActionOptions, Animation2DActionStatus, Animation2DBinding, Animation2DBindingMask, Animation2DBlendMode, Animation2DClip, Animation2DEffectCue, Animation2DEffectEvent, Animation2DLoopMode, Animation2DMutablePose, Animation2DTrack } from './Types.js';
|
|
2
|
+
import { Animation2DSampler } from './Sampler.js';
|
|
3
|
+
export interface Animation2DActionOwner {
|
|
4
|
+
readonly time: number;
|
|
5
|
+
assertActive(): void;
|
|
6
|
+
}
|
|
7
|
+
export interface Animation2DActionTrackRuntime {
|
|
8
|
+
readonly track: Animation2DTrack;
|
|
9
|
+
readonly sampler: Animation2DSampler;
|
|
10
|
+
readonly reference: Float32Array;
|
|
11
|
+
}
|
|
12
|
+
interface RuntimeEffect {
|
|
13
|
+
readonly cue: Animation2DEffectCue;
|
|
14
|
+
readonly start: number;
|
|
15
|
+
readonly end: number;
|
|
16
|
+
readonly fullSpan: boolean;
|
|
17
|
+
readonly loopBehavior: 'continue' | 'restart';
|
|
18
|
+
readonly enterEvent: Animation2DEffectEvent;
|
|
19
|
+
readonly exitEvent: Animation2DEffectEvent;
|
|
20
|
+
readonly restartEvent: Animation2DEffectEvent;
|
|
21
|
+
readonly loopEvent: Animation2DEffectEvent;
|
|
22
|
+
readonly seekEvent: Animation2DEffectEvent;
|
|
23
|
+
}
|
|
24
|
+
/** @internal Reusable exact state used by controller-owned transactions. */
|
|
25
|
+
export interface Animation2DActionSynchronizedState {
|
|
26
|
+
status: Animation2DActionStatus;
|
|
27
|
+
paused: boolean;
|
|
28
|
+
time: number;
|
|
29
|
+
rawTime: number;
|
|
30
|
+
timeScale: number;
|
|
31
|
+
weight: number;
|
|
32
|
+
loop: Animation2DLoopMode;
|
|
33
|
+
repetitions: number;
|
|
34
|
+
clampWhenFinished: boolean;
|
|
35
|
+
blendMode: Animation2DBlendMode;
|
|
36
|
+
mask: Animation2DBindingMask | null;
|
|
37
|
+
layer: number;
|
|
38
|
+
effectsStarted: boolean;
|
|
39
|
+
fadeActive: boolean;
|
|
40
|
+
fadeStart: number;
|
|
41
|
+
fadeEnd: number;
|
|
42
|
+
fadeFrom: number;
|
|
43
|
+
fadeTo: number;
|
|
44
|
+
fadeValue: number;
|
|
45
|
+
readonly effectActive: Uint8Array;
|
|
46
|
+
readonly pendingEffects: Animation2DEffectEvent[];
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Mutable mixer-owned playback state. Effect lifecycle records and sampler
|
|
50
|
+
* outputs are allocated at construction and reused on every frame.
|
|
51
|
+
*/
|
|
52
|
+
export declare class Animation2DActionRuntime {
|
|
53
|
+
readonly id: string;
|
|
54
|
+
readonly clip: Animation2DClip;
|
|
55
|
+
readonly order: number;
|
|
56
|
+
readonly runtimeTracks: readonly Animation2DActionTrackRuntime[];
|
|
57
|
+
readonly runtimeEffects: readonly RuntimeEffect[];
|
|
58
|
+
private readonly _owner;
|
|
59
|
+
private readonly _effectActive;
|
|
60
|
+
private readonly _pendingEffects;
|
|
61
|
+
private readonly _pendingEffectOutput;
|
|
62
|
+
private _valid;
|
|
63
|
+
private _status;
|
|
64
|
+
private _paused;
|
|
65
|
+
private _time;
|
|
66
|
+
private _rawTime;
|
|
67
|
+
private _timeScale;
|
|
68
|
+
private _weight;
|
|
69
|
+
private _loop;
|
|
70
|
+
private _repetitions;
|
|
71
|
+
private _clampWhenFinished;
|
|
72
|
+
private _blendMode;
|
|
73
|
+
private _mask;
|
|
74
|
+
private _layer;
|
|
75
|
+
private _effectsStarted;
|
|
76
|
+
private _fadeActive;
|
|
77
|
+
private _fadeStart;
|
|
78
|
+
private _fadeEnd;
|
|
79
|
+
private _fadeFrom;
|
|
80
|
+
private _fadeTo;
|
|
81
|
+
private _fadeValue;
|
|
82
|
+
constructor(owner: Animation2DActionOwner, clip: Animation2DClip, id: string, order: number, options?: Animation2DActionOptions);
|
|
83
|
+
get duration(): number;
|
|
84
|
+
get status(): Animation2DActionStatus;
|
|
85
|
+
get paused(): boolean;
|
|
86
|
+
set paused(value: boolean);
|
|
87
|
+
get time(): number;
|
|
88
|
+
set time(value: number);
|
|
89
|
+
get timeScale(): number;
|
|
90
|
+
set timeScale(value: number);
|
|
91
|
+
get weight(): number;
|
|
92
|
+
set weight(value: number);
|
|
93
|
+
get layer(): number;
|
|
94
|
+
set layer(value: number);
|
|
95
|
+
get loop(): Animation2DLoopMode;
|
|
96
|
+
set loop(value: Animation2DLoopMode);
|
|
97
|
+
get repetitions(): number;
|
|
98
|
+
set repetitions(value: number);
|
|
99
|
+
get clampWhenFinished(): boolean;
|
|
100
|
+
set clampWhenFinished(value: boolean);
|
|
101
|
+
get blendMode(): Animation2DBlendMode;
|
|
102
|
+
set blendMode(value: Animation2DBlendMode);
|
|
103
|
+
get mask(): Animation2DBindingMask | null;
|
|
104
|
+
set mask(value: Animation2DBindingMask | null);
|
|
105
|
+
get effectiveWeight(): number;
|
|
106
|
+
play(): this;
|
|
107
|
+
pause(): this;
|
|
108
|
+
stop(): this;
|
|
109
|
+
reset(): this;
|
|
110
|
+
seek(timeSeconds: number): this;
|
|
111
|
+
/**
|
|
112
|
+
* Advances a controller-owned absolute playhead without classifying the
|
|
113
|
+
* move as a seek. Crossed side-effect boundaries are queued exactly once.
|
|
114
|
+
*/
|
|
115
|
+
synchronizeTime(timeSeconds: number): this;
|
|
116
|
+
reverse(): this;
|
|
117
|
+
fadeTo(targetWeight: number, durationSeconds: number): this;
|
|
118
|
+
fadeIn(durationSeconds: number): this;
|
|
119
|
+
fadeOut(durationSeconds: number): this;
|
|
120
|
+
crossFadeFrom(source: Animation2DActionRuntime, durationSeconds: number): this;
|
|
121
|
+
crossFadeTo(destination: Animation2DActionRuntime, durationSeconds: number): this;
|
|
122
|
+
acceptsBinding(binding: Animation2DBinding): boolean;
|
|
123
|
+
flushPendingEffects(out: Animation2DMutablePose): void;
|
|
124
|
+
advance(mixerDelta: number, out: Animation2DMutablePose): void;
|
|
125
|
+
/** @internal Allocates one checkpoint that can be reused for every update. */
|
|
126
|
+
createSynchronizedState(): Animation2DActionSynchronizedState;
|
|
127
|
+
/** @internal Captures playhead, fade, and effect-cursor state without sampling. */
|
|
128
|
+
captureSynchronizedState(state: Animation2DActionSynchronizedState): void;
|
|
129
|
+
/** @internal Restores an exact controller transaction checkpoint. */
|
|
130
|
+
restoreSynchronizedState(state: Animation2DActionSynchronizedState): void;
|
|
131
|
+
invalidate(): void;
|
|
132
|
+
private _setSampleTime;
|
|
133
|
+
private _emitInitialEffects;
|
|
134
|
+
private _emitEffectCrossings;
|
|
135
|
+
private _emitOnceEffectCrossings;
|
|
136
|
+
private _emitRepeatEffectCrossings;
|
|
137
|
+
private _emitPingPongEffectCrossings;
|
|
138
|
+
private _emitLoopEffect;
|
|
139
|
+
private _syncEffectActivity;
|
|
140
|
+
private _queueActiveExits;
|
|
141
|
+
private _scheduleFade;
|
|
142
|
+
private _fadeFactor;
|
|
143
|
+
private _finishFade;
|
|
144
|
+
private _assertSibling;
|
|
145
|
+
private _clampSynchronizedTime;
|
|
146
|
+
private _terminalDirection;
|
|
147
|
+
private _resetSamplerCursors;
|
|
148
|
+
private _assertValid;
|
|
149
|
+
}
|
|
150
|
+
export {};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { AnimationStateMachineActionOptions, AnimationStateMachineMixerPort } from '../../../animation-state-machine/runtime/AnimationStateMachineMixerPort.js';
|
|
2
|
+
import { Animation2DActionRuntime, type Animation2DActionOwner } from './Action.js';
|
|
3
|
+
import type { Animation2DActionOptions, Animation2DClip, Animation2DMutablePose, Animation2DPose } from './Types.js';
|
|
4
|
+
/**
|
|
5
|
+
* Format-independent 2D pose mixer and shared state-machine mixer port.
|
|
6
|
+
*
|
|
7
|
+
* Action/track/layer accumulators are retained across frames. Once actions
|
|
8
|
+
* and their masks/layers have been warmed, update/evaluate allocates no
|
|
9
|
+
* action- or property-proportional temporary objects.
|
|
10
|
+
*/
|
|
11
|
+
export declare class Animation2DMixerRuntime implements Animation2DActionOwner, AnimationStateMachineMixerPort<Animation2DActionRuntime> {
|
|
12
|
+
private readonly _clips;
|
|
13
|
+
private readonly _actions;
|
|
14
|
+
private readonly _actionsById;
|
|
15
|
+
private readonly _accumulators;
|
|
16
|
+
private readonly _accumulatorList;
|
|
17
|
+
private readonly _stateMachineLayers;
|
|
18
|
+
private _destroyed;
|
|
19
|
+
private _time;
|
|
20
|
+
private _timeScale;
|
|
21
|
+
private _nextActionId;
|
|
22
|
+
private _nextActionOrder;
|
|
23
|
+
private _nextStateMachineLayer;
|
|
24
|
+
constructor(clips?: readonly Animation2DClip[]);
|
|
25
|
+
get time(): number;
|
|
26
|
+
get timeScale(): number;
|
|
27
|
+
set timeScale(value: number);
|
|
28
|
+
get actions(): readonly Animation2DActionRuntime[];
|
|
29
|
+
get liveBindingCount(): number;
|
|
30
|
+
registerClip(clip: Animation2DClip): this;
|
|
31
|
+
unregisterClip(clipId: string): boolean;
|
|
32
|
+
createAction(clip: Animation2DClip, options?: Animation2DActionOptions): Animation2DActionRuntime;
|
|
33
|
+
createAction(clipId: string, options: AnimationStateMachineActionOptions): Animation2DActionRuntime;
|
|
34
|
+
getAction(actionId: string): Animation2DActionRuntime | null;
|
|
35
|
+
removeAction(action: Animation2DActionRuntime | string): boolean;
|
|
36
|
+
update(deltaSeconds: number, out: Animation2DMutablePose): Animation2DPose;
|
|
37
|
+
evaluate(out: Animation2DMutablePose): Animation2DPose;
|
|
38
|
+
setMixerTime(timeSeconds: number, out: Animation2DMutablePose): Animation2DPose;
|
|
39
|
+
play(action: Animation2DActionRuntime): void;
|
|
40
|
+
stop(action: Animation2DActionRuntime): void;
|
|
41
|
+
fade(action: Animation2DActionRuntime, targetWeight: number, durationSeconds: number): void;
|
|
42
|
+
setWeight(action: Animation2DActionRuntime, weight: number): void;
|
|
43
|
+
setTime(action: Animation2DActionRuntime, timeSeconds: number): void;
|
|
44
|
+
setTimeScale(action: Animation2DActionRuntime, timeScale: number): void;
|
|
45
|
+
destroyAction(action: Animation2DActionRuntime): void;
|
|
46
|
+
destroy(): void;
|
|
47
|
+
assertActive(): void;
|
|
48
|
+
private _advanceActions;
|
|
49
|
+
private _evaluateInto;
|
|
50
|
+
private _retainBinding;
|
|
51
|
+
private _releaseBinding;
|
|
52
|
+
private _stateMachineLayer;
|
|
53
|
+
private _assertOwned;
|
|
54
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Animation2DBinding, Animation2DEffectEvent, Animation2DMutablePose, Animation2DPose, Animation2DPoseChannel } from './Types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Caller-owned frame-transient pose. Channel records, numeric storage, and
|
|
4
|
+
* effect arrays are reused after warmup.
|
|
5
|
+
*/
|
|
6
|
+
export declare class Animation2DPoseBuffer implements Animation2DMutablePose, Animation2DPose {
|
|
7
|
+
private readonly _channelPool;
|
|
8
|
+
private readonly _channels;
|
|
9
|
+
private readonly _effects;
|
|
10
|
+
private _sequence;
|
|
11
|
+
private _mixerTime;
|
|
12
|
+
private _sealed;
|
|
13
|
+
get sequence(): number;
|
|
14
|
+
get mixerTime(): number;
|
|
15
|
+
get channels(): readonly Animation2DPoseChannel[];
|
|
16
|
+
get effects(): readonly Animation2DEffectEvent[];
|
|
17
|
+
reset(mixerTime: number): void;
|
|
18
|
+
writeNumeric(binding: Animation2DBinding, value: ArrayLike<number>): void;
|
|
19
|
+
writeDiscrete(binding: Animation2DBinding, value: unknown): void;
|
|
20
|
+
emit(effect: Animation2DEffectEvent): void;
|
|
21
|
+
seal(): Animation2DPose;
|
|
22
|
+
private _channelAt;
|
|
23
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Animation2DBinding, Animation2DTrack } from './Types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Stateful allocation-free sampler. Rotation values are radians and LINEAR
|
|
4
|
+
* sampling follows the shortest signed arc in [-PI, PI).
|
|
5
|
+
*/
|
|
6
|
+
export declare class Animation2DSampler {
|
|
7
|
+
readonly track: Animation2DTrack;
|
|
8
|
+
readonly output: Float32Array;
|
|
9
|
+
discreteValue: unknown;
|
|
10
|
+
private _cursor;
|
|
11
|
+
constructor(track: Animation2DTrack);
|
|
12
|
+
sample(timeSeconds: number, out?: Float32Array): Float32Array | unknown;
|
|
13
|
+
resetCursor(): void;
|
|
14
|
+
private _findKey;
|
|
15
|
+
}
|
|
16
|
+
export declare function wrapAngle(value: number): number;
|
|
17
|
+
export declare function isNumericBinding(binding: Animation2DBinding): boolean;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import type { AnimationStateMachineBindingMask, AnimationStateMachineBlendMode, AnimationStateMachineLoopMode } from '../../../animation-state-machine/AnimationStateMachine.js';
|
|
2
|
+
export type Animation2DBindingStrategy = 'continuous' | 'rotation' | 'discrete' | 'dominant';
|
|
3
|
+
export interface Animation2DBinding {
|
|
4
|
+
/** Stable mask and pose channel id. */
|
|
5
|
+
readonly id: string;
|
|
6
|
+
/** Stable node, slot, component, or graph target id. */
|
|
7
|
+
readonly targetId: string;
|
|
8
|
+
/** Examples: transform.position, opacity, text, sprite, composite, mask. */
|
|
9
|
+
readonly path: string;
|
|
10
|
+
readonly strategy: Animation2DBindingStrategy;
|
|
11
|
+
/** Required for continuous and rotation bindings; rotation must use one value. */
|
|
12
|
+
readonly valueSize?: number;
|
|
13
|
+
/** Base used when a continuous layer has less than unit weight. */
|
|
14
|
+
readonly defaultValue?: Readonly<ArrayLike<number>> | unknown;
|
|
15
|
+
}
|
|
16
|
+
export type Animation2DInterpolation = 'step' | 'linear' | 'cubic-bezier';
|
|
17
|
+
export interface Animation2DNumericTrack {
|
|
18
|
+
readonly id: string;
|
|
19
|
+
readonly binding: Animation2DBinding;
|
|
20
|
+
readonly interpolation: Animation2DInterpolation;
|
|
21
|
+
readonly times: Float32Array;
|
|
22
|
+
/** Tightly packed key values by binding.valueSize. */
|
|
23
|
+
readonly values: Float32Array;
|
|
24
|
+
/** Per-segment x1, y1, x2, y2 tuples for cubic-bezier interpolation. */
|
|
25
|
+
readonly easings?: Float32Array;
|
|
26
|
+
/** Relative outgoing/incoming spatial controls for transform.position. */
|
|
27
|
+
readonly spatialTangents?: Float32Array;
|
|
28
|
+
}
|
|
29
|
+
export interface Animation2DDiscreteTrack {
|
|
30
|
+
readonly id: string;
|
|
31
|
+
readonly binding: Animation2DBinding;
|
|
32
|
+
readonly interpolation: 'step';
|
|
33
|
+
/** One immutable/reference-stable value per key. */
|
|
34
|
+
readonly times: Float32Array;
|
|
35
|
+
readonly values: readonly unknown[];
|
|
36
|
+
}
|
|
37
|
+
export type Animation2DTrack = Animation2DNumericTrack | Animation2DDiscreteTrack;
|
|
38
|
+
export type Animation2DEffectKind = 'audio' | 'particle';
|
|
39
|
+
export type Animation2DEffectLoopBehavior = 'continue' | 'restart';
|
|
40
|
+
export interface Animation2DEffectCue {
|
|
41
|
+
readonly id: string;
|
|
42
|
+
readonly kind: Animation2DEffectKind;
|
|
43
|
+
readonly start: number;
|
|
44
|
+
/** Defaults to clip duration. The interval is [start, end). */
|
|
45
|
+
readonly end?: number;
|
|
46
|
+
/** Audio defaults to continue; particle defaults to restart. */
|
|
47
|
+
readonly loopBehavior?: Animation2DEffectLoopBehavior;
|
|
48
|
+
readonly payload?: unknown;
|
|
49
|
+
}
|
|
50
|
+
export interface Animation2DClip {
|
|
51
|
+
readonly format: 'haiyue-animation2d-clip@1';
|
|
52
|
+
readonly id: string;
|
|
53
|
+
readonly name: string;
|
|
54
|
+
readonly duration: number;
|
|
55
|
+
readonly tracks: readonly Animation2DTrack[];
|
|
56
|
+
readonly effects?: readonly Animation2DEffectCue[];
|
|
57
|
+
}
|
|
58
|
+
export type Animation2DEffectLifecycle = 'enter' | 'exit' | 'restart' | 'loop' | 'seek';
|
|
59
|
+
export interface Animation2DEffectEvent {
|
|
60
|
+
readonly actionId: string;
|
|
61
|
+
readonly clipId: string;
|
|
62
|
+
readonly cue: Animation2DEffectCue;
|
|
63
|
+
readonly lifecycle: Animation2DEffectLifecycle;
|
|
64
|
+
}
|
|
65
|
+
export interface Animation2DPoseChannel {
|
|
66
|
+
readonly binding: Animation2DBinding;
|
|
67
|
+
/**
|
|
68
|
+
* Continuous and rotation channels expose a reused Float32Array. Discrete
|
|
69
|
+
* and dominant channels expose the winning authored value by reference.
|
|
70
|
+
*/
|
|
71
|
+
readonly value: Readonly<Float32Array> | unknown;
|
|
72
|
+
}
|
|
73
|
+
export interface Animation2DPose {
|
|
74
|
+
readonly sequence: number;
|
|
75
|
+
readonly mixerTime: number;
|
|
76
|
+
readonly channels: readonly Animation2DPoseChannel[];
|
|
77
|
+
readonly effects: readonly Animation2DEffectEvent[];
|
|
78
|
+
}
|
|
79
|
+
export interface Animation2DMutablePose {
|
|
80
|
+
reset(mixerTime: number): void;
|
|
81
|
+
writeNumeric(binding: Animation2DBinding, value: ArrayLike<number>): void;
|
|
82
|
+
writeDiscrete(binding: Animation2DBinding, value: unknown): void;
|
|
83
|
+
emit(effect: Animation2DEffectEvent): void;
|
|
84
|
+
seal(): Animation2DPose;
|
|
85
|
+
}
|
|
86
|
+
export interface Animation2DActionOptions {
|
|
87
|
+
readonly id?: string;
|
|
88
|
+
readonly loop?: AnimationStateMachineLoopMode;
|
|
89
|
+
readonly repetitions?: number;
|
|
90
|
+
readonly clampWhenFinished?: boolean;
|
|
91
|
+
readonly timeScale?: number;
|
|
92
|
+
readonly weight?: number;
|
|
93
|
+
/** Ascending layers are applied in order; a higher layer overrides a lower one. */
|
|
94
|
+
readonly layer?: number;
|
|
95
|
+
readonly blendMode?: AnimationStateMachineBlendMode;
|
|
96
|
+
readonly mask?: AnimationStateMachineBindingMask;
|
|
97
|
+
}
|
|
98
|
+
export type Animation2DActionStatus = 'idle' | 'running' | 'paused' | 'finished' | 'stopped';
|
|
99
|
+
export type Animation2DLoopMode = AnimationStateMachineLoopMode;
|
|
100
|
+
export type Animation2DBlendMode = AnimationStateMachineBlendMode;
|
|
101
|
+
export type Animation2DBindingMask = AnimationStateMachineBindingMask;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { Animation2DActionRuntime } from './Action.js';
|
|
2
|
+
export type { Animation2DActionOwner, Animation2DActionSynchronizedState, Animation2DActionTrackRuntime, } from './Action.js';
|
|
3
|
+
export { Animation2DMixerRuntime } from './Mixer.js';
|
|
4
|
+
export { Animation2DPoseBuffer } from './PoseBuffer.js';
|
|
5
|
+
export { Animation2DSampler, wrapAngle } from './Sampler.js';
|
|
6
|
+
export type { Animation2DActionOptions, Animation2DActionStatus, Animation2DBinding, Animation2DBindingMask, Animation2DBindingStrategy, Animation2DBlendMode, Animation2DClip, Animation2DDiscreteTrack, Animation2DEffectCue, Animation2DEffectEvent, Animation2DEffectKind, Animation2DEffectLifecycle, Animation2DEffectLoopBehavior, Animation2DInterpolation, Animation2DLoopMode, Animation2DMutablePose, Animation2DNumericTrack, Animation2DPose, Animation2DPoseChannel, Animation2DTrack, } from './Types.js';
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
export type AnimationStateMachineLoopMode = 'once' | 'repeat' | 'ping-pong';
|
|
2
|
+
export type AnimationStateMachineBlendMode = 'override' | 'additive';
|
|
3
|
+
/**
|
|
4
|
+
* A state-machine mask addresses logical animation bindings. The concrete 2D
|
|
5
|
+
* or 3D mixer decides how those stable ids resolve to runtime targets.
|
|
6
|
+
*/
|
|
7
|
+
export interface AnimationStateMachineBindingMask {
|
|
8
|
+
/** Empty or omitted include means all bindings are eligible. */
|
|
9
|
+
readonly include?: readonly string[];
|
|
10
|
+
readonly exclude?: readonly string[];
|
|
11
|
+
}
|
|
12
|
+
export type AnimationStateMachineParameterDefinition = Readonly<{
|
|
13
|
+
name: string;
|
|
14
|
+
type: 'float';
|
|
15
|
+
defaultValue: number;
|
|
16
|
+
}> | Readonly<{
|
|
17
|
+
name: string;
|
|
18
|
+
type: 'integer';
|
|
19
|
+
defaultValue: number;
|
|
20
|
+
}> | Readonly<{
|
|
21
|
+
name: string;
|
|
22
|
+
type: 'boolean';
|
|
23
|
+
defaultValue: boolean;
|
|
24
|
+
}> | Readonly<{
|
|
25
|
+
name: string;
|
|
26
|
+
type: 'trigger';
|
|
27
|
+
}>;
|
|
28
|
+
export type AnimationStateMachineTransitionCondition = Readonly<{
|
|
29
|
+
parameter: string;
|
|
30
|
+
operator: 'greater' | 'greater-or-equal' | 'less' | 'less-or-equal';
|
|
31
|
+
value: number;
|
|
32
|
+
}> | Readonly<{
|
|
33
|
+
parameter: string;
|
|
34
|
+
operator: 'equal' | 'not-equal';
|
|
35
|
+
value: number | boolean;
|
|
36
|
+
}> | Readonly<{
|
|
37
|
+
parameter: string;
|
|
38
|
+
operator: 'is-true' | 'is-false' | 'triggered';
|
|
39
|
+
}>;
|
|
40
|
+
export interface AnimationStateMachineClipMotion {
|
|
41
|
+
readonly kind: 'clip';
|
|
42
|
+
/**
|
|
43
|
+
* Mixer-owned source id. It may identify a 3D clip, a HYA composition, or
|
|
44
|
+
* another animation source understood by the selected mixer port.
|
|
45
|
+
*/
|
|
46
|
+
readonly clipId: string;
|
|
47
|
+
}
|
|
48
|
+
export interface AnimationStateMachineBlend1DChild {
|
|
49
|
+
readonly threshold: number;
|
|
50
|
+
readonly motion: AnimationStateMachineMotionDefinition;
|
|
51
|
+
}
|
|
52
|
+
export interface AnimationStateMachineBlend1DMotion {
|
|
53
|
+
readonly kind: 'blend-1d';
|
|
54
|
+
readonly parameter: string;
|
|
55
|
+
readonly children: readonly AnimationStateMachineBlend1DChild[];
|
|
56
|
+
}
|
|
57
|
+
export interface AnimationStateMachineBlend2DChild {
|
|
58
|
+
readonly position: readonly [number, number];
|
|
59
|
+
readonly motion: AnimationStateMachineMotionDefinition;
|
|
60
|
+
}
|
|
61
|
+
export interface AnimationStateMachineBlend2DMotion {
|
|
62
|
+
readonly kind: 'blend-2d';
|
|
63
|
+
readonly algorithm: 'cartesian' | 'directional';
|
|
64
|
+
readonly parameterX: string;
|
|
65
|
+
readonly parameterY: string;
|
|
66
|
+
readonly children: readonly AnimationStateMachineBlend2DChild[];
|
|
67
|
+
}
|
|
68
|
+
export type AnimationStateMachineMotionDefinition = AnimationStateMachineClipMotion | AnimationStateMachineBlend1DMotion | AnimationStateMachineBlend2DMotion;
|
|
69
|
+
export interface AnimationStateMachineStateDefinition {
|
|
70
|
+
readonly id: string;
|
|
71
|
+
readonly name: string;
|
|
72
|
+
readonly motion: AnimationStateMachineMotionDefinition;
|
|
73
|
+
readonly speed?: number;
|
|
74
|
+
readonly speedParameter?: string;
|
|
75
|
+
readonly loop?: AnimationStateMachineLoopMode;
|
|
76
|
+
}
|
|
77
|
+
export type AnimationStateMachineTransitionInterruption = 'none' | 'source' | 'destination' | 'source-then-destination' | 'destination-then-source';
|
|
78
|
+
export interface AnimationStateMachineTransitionDefinition {
|
|
79
|
+
readonly id: string;
|
|
80
|
+
/** '*' means any state in the same layer. */
|
|
81
|
+
readonly from: string | '*';
|
|
82
|
+
readonly to: string;
|
|
83
|
+
readonly conditions: readonly AnimationStateMachineTransitionCondition[];
|
|
84
|
+
readonly duration: number;
|
|
85
|
+
readonly hasExitTime?: boolean;
|
|
86
|
+
readonly exitTime?: number;
|
|
87
|
+
readonly destinationOffset?: number;
|
|
88
|
+
readonly interruption?: AnimationStateMachineTransitionInterruption;
|
|
89
|
+
}
|
|
90
|
+
export interface AnimationStateMachineLayer {
|
|
91
|
+
readonly id: string;
|
|
92
|
+
readonly name: string;
|
|
93
|
+
readonly initialStateId: string;
|
|
94
|
+
readonly states: readonly AnimationStateMachineStateDefinition[];
|
|
95
|
+
/** Declaration order is transition priority. */
|
|
96
|
+
readonly transitions: readonly AnimationStateMachineTransitionDefinition[];
|
|
97
|
+
readonly blendMode?: AnimationStateMachineBlendMode;
|
|
98
|
+
readonly weight?: number;
|
|
99
|
+
readonly mask?: AnimationStateMachineBindingMask;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Dimension-neutral serializable state-machine definition. Runtime controller
|
|
103
|
+
* state and concrete mixer objects are intentionally not stored here.
|
|
104
|
+
*/
|
|
105
|
+
export interface AnimationStateMachineDefinition {
|
|
106
|
+
readonly format: 'haiyue-animation-state-machine@1';
|
|
107
|
+
readonly id: string;
|
|
108
|
+
readonly name: string;
|
|
109
|
+
readonly parameters: readonly AnimationStateMachineParameterDefinition[];
|
|
110
|
+
readonly layers: readonly AnimationStateMachineLayer[];
|
|
111
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { HYA_STATE_MACHINE_CHANNEL_REGISTRY, hyaStateMachineChannelCapability, type HyaStateMachineChannelCapability, type HyaStateMachineChannelId, type HyaStateMachineDefinition } from '@haiyue/animation-spec';
|
|
2
|
+
export { HYA_STATE_MACHINE_CHANNEL_REGISTRY, hyaStateMachineChannelCapability, };
|
|
3
|
+
export type { HyaStateMachineChannelCapability, HyaStateMachineChannelId, };
|
|
4
|
+
export type AnimationStateMachineChannelDiagnosticCode = NonNullable<HyaStateMachineChannelCapability['diagnosticCode']> | 'W_STATE_MACHINE_CHANNEL_AUDIO_AUTOPLAY_REJECTED';
|
|
5
|
+
export interface AnimationStateMachineChannelDiagnostic {
|
|
6
|
+
readonly code: AnimationStateMachineChannelDiagnosticCode;
|
|
7
|
+
readonly severity: 'warning' | 'error';
|
|
8
|
+
readonly channelId: HyaStateMachineChannelId;
|
|
9
|
+
readonly path: string;
|
|
10
|
+
readonly message: string;
|
|
11
|
+
}
|
|
12
|
+
export declare class AnimationStateMachineChannelError extends Error {
|
|
13
|
+
readonly diagnostic: AnimationStateMachineChannelDiagnostic;
|
|
14
|
+
readonly name = "AnimationStateMachineChannelError";
|
|
15
|
+
constructor(diagnostic: AnimationStateMachineChannelDiagnostic);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Audio owns one HTMLMediaElement playhead and is intentionally not amplitude
|
|
19
|
+
* mixed. It is executable only when the graph can never overlap two motions.
|
|
20
|
+
*/
|
|
21
|
+
export declare function audioStateMachineCompatibilityDiagnostic(definition: HyaStateMachineDefinition, path?: string): AnimationStateMachineChannelDiagnostic | null;
|
|
22
|
+
export declare function assertAudioStateMachineCompatible(definition: HyaStateMachineDefinition, path?: string): void;
|
|
23
|
+
export declare function audioAutoplayRejectedDiagnostic(path: string, reason?: unknown): AnimationStateMachineChannelDiagnostic;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { Animation2DActionRuntime } from '../../animation/runtime/mixer/Action.js';
|
|
2
|
+
import { Animation2DMixerRuntime } from '../../animation/runtime/mixer/Mixer.js';
|
|
3
|
+
import type { AnimationStateMachineActionOptions, AnimationStateMachineMixerPort } from './AnimationStateMachineMixerPort.js';
|
|
4
|
+
export declare class Animation2DStateMachineActionRuntimeHandle {
|
|
5
|
+
readonly duration: number;
|
|
6
|
+
readonly clipId: string;
|
|
7
|
+
readonly action: Animation2DActionRuntime;
|
|
8
|
+
targetTime: number;
|
|
9
|
+
playing: boolean;
|
|
10
|
+
destroyed: boolean;
|
|
11
|
+
pendingDestroy: boolean;
|
|
12
|
+
private readonly _checkpoint;
|
|
13
|
+
private _checkpointTargetTime;
|
|
14
|
+
private _checkpointPlaying;
|
|
15
|
+
constructor(clipId: string, action: Animation2DActionRuntime);
|
|
16
|
+
captureTransactionState(): void;
|
|
17
|
+
restoreTransactionState(): void;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Transactional state-machine owner for the existing 2D mixer. It never
|
|
21
|
+
* samples tracks itself: absolute controller playheads are synchronized into
|
|
22
|
+
* the mixer actions, and the caller evaluates the ordinary shared pose buffer.
|
|
23
|
+
*/
|
|
24
|
+
export declare class Animation2DStateMachineMixerAdapter implements AnimationStateMachineMixerPort<Animation2DStateMachineActionRuntimeHandle> {
|
|
25
|
+
readonly mixer: Animation2DMixerRuntime;
|
|
26
|
+
private readonly _handles;
|
|
27
|
+
private readonly _transactionHandles;
|
|
28
|
+
private readonly _transactionCreated;
|
|
29
|
+
private readonly _transactionPendingDestroy;
|
|
30
|
+
private _transactionActive;
|
|
31
|
+
private _destroyed;
|
|
32
|
+
constructor(mixer: Animation2DMixerRuntime);
|
|
33
|
+
get liveActionCount(): number;
|
|
34
|
+
get liveBindingCount(): number;
|
|
35
|
+
createAction(clipId: string, options: AnimationStateMachineActionOptions): Animation2DStateMachineActionRuntimeHandle;
|
|
36
|
+
play(handle: Animation2DStateMachineActionRuntimeHandle): void;
|
|
37
|
+
stop(handle: Animation2DStateMachineActionRuntimeHandle): void;
|
|
38
|
+
fade(handle: Animation2DStateMachineActionRuntimeHandle, _targetWeight: number, _durationSeconds: number): void;
|
|
39
|
+
setWeight(handle: Animation2DStateMachineActionRuntimeHandle, weight: number): void;
|
|
40
|
+
setTime(handle: Animation2DStateMachineActionRuntimeHandle, timeSeconds: number): void;
|
|
41
|
+
setTimeScale(handle: Animation2DStateMachineActionRuntimeHandle, timeScale: number): void;
|
|
42
|
+
destroyAction(handle: Animation2DStateMachineActionRuntimeHandle): void;
|
|
43
|
+
beginControllerTransaction(): void;
|
|
44
|
+
commitControllerTransaction(): void;
|
|
45
|
+
rollbackControllerTransaction(): void;
|
|
46
|
+
destroy(): void;
|
|
47
|
+
private _destroyHandleNow;
|
|
48
|
+
private _clearTransaction;
|
|
49
|
+
private _requireHandle;
|
|
50
|
+
private _requireActive;
|
|
51
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { CompiledAnimation3DBlend1DMotion, CompiledAnimation3DBlend2DMotion } from './AnimationStateMachineCompiler.js';
|
|
2
|
+
/**
|
|
3
|
+
* Evaluates direct child weights for a compiled 1D blend tree. Values outside
|
|
4
|
+
* the authored threshold range clamp to the nearest endpoint.
|
|
5
|
+
*/
|
|
6
|
+
export declare function evaluateAnimation3DBlend1DWeights(motion: CompiledAnimation3DBlend1DMotion, value: number, out?: Float64Array): Float64Array;
|
|
7
|
+
/**
|
|
8
|
+
* Evaluates direct child weights for a compiled 2D blend tree.
|
|
9
|
+
*
|
|
10
|
+
* Cartesian trees use a deterministic containing simplex after projecting
|
|
11
|
+
* outside samples to the convex hull. Directional trees interpolate the two
|
|
12
|
+
* surrounding authored directions and then interpolate/clamp radially.
|
|
13
|
+
*/
|
|
14
|
+
export declare function evaluateAnimation3DBlend2DWeights(motion: CompiledAnimation3DBlend2DMotion, x: number, y: number, out?: Float64Array): Float64Array;
|