@aura3d/animation 1.0.6

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 (187) hide show
  1. package/README.md +19 -0
  2. package/dist/AnimationAction.d.ts +40 -0
  3. package/dist/AnimationAction.d.ts.map +1 -0
  4. package/dist/AnimationAction.js +143 -0
  5. package/dist/AnimationAction.js.map +1 -0
  6. package/dist/AnimationClip.d.ts +24 -0
  7. package/dist/AnimationClip.d.ts.map +1 -0
  8. package/dist/AnimationClip.js +45 -0
  9. package/dist/AnimationClip.js.map +1 -0
  10. package/dist/AnimationClipEvents.d.ts +57 -0
  11. package/dist/AnimationClipEvents.d.ts.map +1 -0
  12. package/dist/AnimationClipEvents.js +171 -0
  13. package/dist/AnimationClipEvents.js.map +1 -0
  14. package/dist/AnimationClipRegistry.d.ts +76 -0
  15. package/dist/AnimationClipRegistry.d.ts.map +1 -0
  16. package/dist/AnimationClipRegistry.js +130 -0
  17. package/dist/AnimationClipRegistry.js.map +1 -0
  18. package/dist/AnimationController.d.ts +168 -0
  19. package/dist/AnimationController.d.ts.map +1 -0
  20. package/dist/AnimationController.js +619 -0
  21. package/dist/AnimationController.js.map +1 -0
  22. package/dist/AnimationEvents.d.ts +10 -0
  23. package/dist/AnimationEvents.d.ts.map +1 -0
  24. package/dist/AnimationEvents.js +26 -0
  25. package/dist/AnimationEvents.js.map +1 -0
  26. package/dist/AnimationLayer.d.ts +27 -0
  27. package/dist/AnimationLayer.d.ts.map +1 -0
  28. package/dist/AnimationLayer.js +53 -0
  29. package/dist/AnimationLayer.js.map +1 -0
  30. package/dist/AnimationMixer.d.ts +54 -0
  31. package/dist/AnimationMixer.d.ts.map +1 -0
  32. package/dist/AnimationMixer.js +319 -0
  33. package/dist/AnimationMixer.js.map +1 -0
  34. package/dist/AnimationStateGraph.d.ts +2 -0
  35. package/dist/AnimationStateGraph.d.ts.map +1 -0
  36. package/dist/AnimationStateGraph.js +2 -0
  37. package/dist/AnimationStateGraph.js.map +1 -0
  38. package/dist/AnimationStateMachine.d.ts +59 -0
  39. package/dist/AnimationStateMachine.d.ts.map +1 -0
  40. package/dist/AnimationStateMachine.js +154 -0
  41. package/dist/AnimationStateMachine.js.map +1 -0
  42. package/dist/AnimationTrack.d.ts +23 -0
  43. package/dist/AnimationTrack.d.ts.map +1 -0
  44. package/dist/AnimationTrack.js +124 -0
  45. package/dist/AnimationTrack.js.map +1 -0
  46. package/dist/BlendTree.d.ts +23 -0
  47. package/dist/BlendTree.d.ts.map +1 -0
  48. package/dist/BlendTree.js +68 -0
  49. package/dist/BlendTree.js.map +1 -0
  50. package/dist/Bone.d.ts +20 -0
  51. package/dist/Bone.d.ts.map +1 -0
  52. package/dist/Bone.js +24 -0
  53. package/dist/Bone.js.map +1 -0
  54. package/dist/CrowdAnimation.d.ts +13 -0
  55. package/dist/CrowdAnimation.d.ts.map +1 -0
  56. package/dist/CrowdAnimation.js +14 -0
  57. package/dist/CrowdAnimation.js.map +1 -0
  58. package/dist/ECSAnimationBridge.d.ts +9 -0
  59. package/dist/ECSAnimationBridge.d.ts.map +1 -0
  60. package/dist/ECSAnimationBridge.js +24 -0
  61. package/dist/ECSAnimationBridge.js.map +1 -0
  62. package/dist/HumanoidRetargeting.d.ts +76 -0
  63. package/dist/HumanoidRetargeting.d.ts.map +1 -0
  64. package/dist/HumanoidRetargeting.js +331 -0
  65. package/dist/HumanoidRetargeting.js.map +1 -0
  66. package/dist/IK.d.ts +24 -0
  67. package/dist/IK.d.ts.map +1 -0
  68. package/dist/IK.js +76 -0
  69. package/dist/IK.js.map +1 -0
  70. package/dist/Keyframe.d.ts +50 -0
  71. package/dist/Keyframe.d.ts.map +1 -0
  72. package/dist/Keyframe.js +118 -0
  73. package/dist/Keyframe.js.map +1 -0
  74. package/dist/LocomotionController.d.ts +47 -0
  75. package/dist/LocomotionController.d.ts.map +1 -0
  76. package/dist/LocomotionController.js +106 -0
  77. package/dist/LocomotionController.js.map +1 -0
  78. package/dist/MotionMatchingFixtures.d.ts +58 -0
  79. package/dist/MotionMatchingFixtures.d.ts.map +1 -0
  80. package/dist/MotionMatchingFixtures.js +175 -0
  81. package/dist/MotionMatchingFixtures.js.map +1 -0
  82. package/dist/MotionQuality.d.ts +36 -0
  83. package/dist/MotionQuality.d.ts.map +1 -0
  84. package/dist/MotionQuality.js +117 -0
  85. package/dist/MotionQuality.js.map +1 -0
  86. package/dist/Retargeting.d.ts +12 -0
  87. package/dist/Retargeting.d.ts.map +1 -0
  88. package/dist/Retargeting.js +19 -0
  89. package/dist/Retargeting.js.map +1 -0
  90. package/dist/RootMotion.d.ts +21 -0
  91. package/dist/RootMotion.d.ts.map +1 -0
  92. package/dist/RootMotion.js +84 -0
  93. package/dist/RootMotion.js.map +1 -0
  94. package/dist/SceneAnimationBridge.d.ts +18 -0
  95. package/dist/SceneAnimationBridge.d.ts.map +1 -0
  96. package/dist/SceneAnimationBridge.js +69 -0
  97. package/dist/SceneAnimationBridge.js.map +1 -0
  98. package/dist/SecondaryAnimationFixtures.d.ts +55 -0
  99. package/dist/SecondaryAnimationFixtures.d.ts.map +1 -0
  100. package/dist/SecondaryAnimationFixtures.js +147 -0
  101. package/dist/SecondaryAnimationFixtures.js.map +1 -0
  102. package/dist/Skeleton.d.ts +9 -0
  103. package/dist/Skeleton.d.ts.map +1 -0
  104. package/dist/Skeleton.js +31 -0
  105. package/dist/Skeleton.js.map +1 -0
  106. package/dist/Skinning.d.ts +7 -0
  107. package/dist/Skinning.d.ts.map +1 -0
  108. package/dist/Skinning.js +12 -0
  109. package/dist/Skinning.js.map +1 -0
  110. package/dist/browser-index.d.ts +39 -0
  111. package/dist/browser-index.d.ts.map +1 -0
  112. package/dist/browser-index.js +34 -0
  113. package/dist/browser-index.js.map +1 -0
  114. package/dist/index.d.ts +40 -0
  115. package/dist/index.d.ts.map +1 -0
  116. package/dist/index.js +35 -0
  117. package/dist/index.js.map +1 -0
  118. package/dist/threejs-compatibility/AnimationAction.d.ts +16 -0
  119. package/dist/threejs-compatibility/AnimationAction.d.ts.map +1 -0
  120. package/dist/threejs-compatibility/AnimationAction.js +25 -0
  121. package/dist/threejs-compatibility/AnimationAction.js.map +1 -0
  122. package/dist/threejs-compatibility/AnimationClip.d.ts +14 -0
  123. package/dist/threejs-compatibility/AnimationClip.d.ts.map +1 -0
  124. package/dist/threejs-compatibility/AnimationClip.js +11 -0
  125. package/dist/threejs-compatibility/AnimationClip.js.map +1 -0
  126. package/dist/threejs-compatibility/AnimationDiagnostics.d.ts +44 -0
  127. package/dist/threejs-compatibility/AnimationDiagnostics.d.ts.map +1 -0
  128. package/dist/threejs-compatibility/AnimationDiagnostics.js +29 -0
  129. package/dist/threejs-compatibility/AnimationDiagnostics.js.map +1 -0
  130. package/dist/threejs-compatibility/AnimationMixer.d.ts +9 -0
  131. package/dist/threejs-compatibility/AnimationMixer.d.ts.map +1 -0
  132. package/dist/threejs-compatibility/AnimationMixer.js +24 -0
  133. package/dist/threejs-compatibility/AnimationMixer.js.map +1 -0
  134. package/dist/threejs-compatibility/MorphTargetMixer.d.ts +10 -0
  135. package/dist/threejs-compatibility/MorphTargetMixer.d.ts.map +1 -0
  136. package/dist/threejs-compatibility/MorphTargetMixer.js +10 -0
  137. package/dist/threejs-compatibility/MorphTargetMixer.js.map +1 -0
  138. package/dist/threejs-compatibility/Skeleton.d.ts +10 -0
  139. package/dist/threejs-compatibility/Skeleton.d.ts.map +1 -0
  140. package/dist/threejs-compatibility/Skeleton.js +8 -0
  141. package/dist/threejs-compatibility/Skeleton.js.map +1 -0
  142. package/dist/threejs-compatibility/SkinnedMesh.d.ts +11 -0
  143. package/dist/threejs-compatibility/SkinnedMesh.d.ts.map +1 -0
  144. package/dist/threejs-compatibility/SkinnedMesh.js +16 -0
  145. package/dist/threejs-compatibility/SkinnedMesh.js.map +1 -0
  146. package/dist/threejs-compatibility/index.d.ts +12 -0
  147. package/dist/threejs-compatibility/index.d.ts.map +1 -0
  148. package/dist/threejs-compatibility/index.js +8 -0
  149. package/dist/threejs-compatibility/index.js.map +1 -0
  150. package/package.json +17 -0
  151. package/src/AnimationAction.ts +166 -0
  152. package/src/AnimationClip.ts +63 -0
  153. package/src/AnimationClipEvents.ts +320 -0
  154. package/src/AnimationClipRegistry.ts +280 -0
  155. package/src/AnimationController.ts +967 -0
  156. package/src/AnimationEvents.ts +34 -0
  157. package/src/AnimationLayer.ts +73 -0
  158. package/src/AnimationMixer.ts +366 -0
  159. package/src/AnimationStateGraph.ts +8 -0
  160. package/src/AnimationStateMachine.ts +217 -0
  161. package/src/AnimationTrack.ts +176 -0
  162. package/src/BlendTree.ts +89 -0
  163. package/src/Bone.ts +35 -0
  164. package/src/CrowdAnimation.ts +25 -0
  165. package/src/ECSAnimationBridge.ts +30 -0
  166. package/src/HumanoidRetargeting.ts +476 -0
  167. package/src/IK.ts +107 -0
  168. package/src/Keyframe.ts +159 -0
  169. package/src/LocomotionController.ts +149 -0
  170. package/src/MotionMatchingFixtures.ts +254 -0
  171. package/src/MotionQuality.ts +156 -0
  172. package/src/Retargeting.ts +29 -0
  173. package/src/RootMotion.ts +124 -0
  174. package/src/SceneAnimationBridge.ts +80 -0
  175. package/src/SecondaryAnimationFixtures.ts +212 -0
  176. package/src/Skeleton.ts +34 -0
  177. package/src/Skinning.ts +18 -0
  178. package/src/browser-index.ts +55 -0
  179. package/src/index.ts +56 -0
  180. package/src/threejs-compatibility/AnimationAction.ts +27 -0
  181. package/src/threejs-compatibility/AnimationClip.ts +16 -0
  182. package/src/threejs-compatibility/AnimationDiagnostics.ts +42 -0
  183. package/src/threejs-compatibility/AnimationMixer.ts +24 -0
  184. package/src/threejs-compatibility/MorphTargetMixer.ts +16 -0
  185. package/src/threejs-compatibility/Skeleton.ts +9 -0
  186. package/src/threejs-compatibility/SkinnedMesh.ts +12 -0
  187. package/src/threejs-compatibility/index.ts +11 -0
@@ -0,0 +1,55 @@
1
+ export * from "./Keyframe.js";
2
+ export * from "./AnimationTrack.js";
3
+ export * from "./AnimationClip.js";
4
+ export * from "./AnimationEvents.js";
5
+ export * from "./AnimationAction.js";
6
+ export * from "./AnimationMixer.js";
7
+ export * from "./AnimationLayer.js";
8
+ export * from "./Bone.js";
9
+ export * from "./Skeleton.js";
10
+ export * from "./Skinning.js";
11
+ export * from "./BlendTree.js";
12
+ export * from "./AnimationStateMachine.js";
13
+ export * from "./RootMotion.js";
14
+ export * from "./MotionQuality.js";
15
+ export * from "./LocomotionController.js";
16
+ export * from "./SceneAnimationBridge.js";
17
+ export * from "./ECSAnimationBridge.js";
18
+ export * from "./IK.js";
19
+ export * from "./MotionMatchingFixtures.js";
20
+ export * from "./SecondaryAnimationFixtures.js";
21
+ export * from "./CrowdAnimation.js";
22
+ export * from "./Retargeting.js";
23
+ export * from "./AnimationClipEvents.js";
24
+ export { AnimationClipRegistry } from "./AnimationClipRegistry.js";
25
+ export type {
26
+ AnimationClipDefinition,
27
+ AnimationClipId,
28
+ AnimationClipManifest,
29
+ AnimationClipRegistryDiagnostic,
30
+ AnimationClipRegistryDiagnosticSeverity,
31
+ AnimationClipRegistryOptions,
32
+ AnimationClipSampleContext,
33
+ AnimationClipSampler,
34
+ AnimationKeyframe,
35
+ AnimationTrack as AnimationClipTrack,
36
+ AnimationTrackTarget,
37
+ RegisteredAnimationClip
38
+ } from "./AnimationClipRegistry.js";
39
+ export * from "./AnimationController.js";
40
+ export * from "./HumanoidRetargeting.js";
41
+ export { AnimationClipThreeCompat } from "./threejs-compatibility/AnimationClip.js";
42
+ export type { ThreeCompatKeyframeTrack, ThreeCompatLoopMode } from "./threejs-compatibility/AnimationClip.js";
43
+ export { AnimationActionThreeCompat } from "./threejs-compatibility/AnimationAction.js";
44
+ export { AnimationMixerThreeCompat } from "./threejs-compatibility/AnimationMixer.js";
45
+ export { SkeletonThreeCompat } from "./threejs-compatibility/Skeleton.js";
46
+ export type { ThreeCompatBone } from "./threejs-compatibility/Skeleton.js";
47
+ export { SkinnedMeshThreeCompat } from "./threejs-compatibility/SkinnedMesh.js";
48
+ export { MorphTargetMixerThreeCompat } from "./threejs-compatibility/MorphTargetMixer.js";
49
+ export type { ThreeCompatMorphTargetWeight } from "./threejs-compatibility/MorphTargetMixer.js";
50
+ export {
51
+ createThreeCompatAnimationDiagnostics,
52
+ inspectThreeCompatAnimatedAssets,
53
+ THREE_COMPAT_ANIMATED_GLTF_ASSETS
54
+ } from "./threejs-compatibility/AnimationDiagnostics.js";
55
+ export type { ThreeCompatAnimatedAssetDiagnostic } from "./threejs-compatibility/AnimationDiagnostics.js";
package/src/index.ts ADDED
@@ -0,0 +1,56 @@
1
+ export * from "./Keyframe.js";
2
+ export * from "./AnimationTrack.js";
3
+ export * from "./AnimationClip.js";
4
+ export * from "./AnimationEvents.js";
5
+ export * from "./AnimationAction.js";
6
+ export * from "./AnimationMixer.js";
7
+ export * from "./AnimationLayer.js";
8
+ export * from "./Bone.js";
9
+ export * from "./Skeleton.js";
10
+ export * from "./Skinning.js";
11
+ export * from "./BlendTree.js";
12
+ export * from "./AnimationStateMachine.js";
13
+ export * from "./AnimationStateGraph.js";
14
+ export * from "./RootMotion.js";
15
+ export * from "./MotionQuality.js";
16
+ export * from "./LocomotionController.js";
17
+ export * from "./SceneAnimationBridge.js";
18
+ export * from "./ECSAnimationBridge.js";
19
+ export * from "./IK.js";
20
+ export * from "./MotionMatchingFixtures.js";
21
+ export * from "./SecondaryAnimationFixtures.js";
22
+ export * from "./CrowdAnimation.js";
23
+ export * from "./Retargeting.js";
24
+ export * from "./AnimationClipEvents.js";
25
+ export { AnimationClipRegistry } from "./AnimationClipRegistry.js";
26
+ export type {
27
+ AnimationClipDefinition,
28
+ AnimationClipId,
29
+ AnimationClipManifest,
30
+ AnimationClipRegistryDiagnostic,
31
+ AnimationClipRegistryDiagnosticSeverity,
32
+ AnimationClipRegistryOptions,
33
+ AnimationClipSampleContext,
34
+ AnimationClipSampler,
35
+ AnimationKeyframe,
36
+ AnimationTrack as AnimationClipTrack,
37
+ AnimationTrackTarget,
38
+ RegisteredAnimationClip
39
+ } from "./AnimationClipRegistry.js";
40
+ export * from "./AnimationController.js";
41
+ export * from "./HumanoidRetargeting.js";
42
+ export { AnimationClipThreeCompat } from "./threejs-compatibility/AnimationClip.js";
43
+ export type { ThreeCompatKeyframeTrack, ThreeCompatLoopMode } from "./threejs-compatibility/AnimationClip.js";
44
+ export { AnimationActionThreeCompat } from "./threejs-compatibility/AnimationAction.js";
45
+ export { AnimationMixerThreeCompat } from "./threejs-compatibility/AnimationMixer.js";
46
+ export { SkeletonThreeCompat } from "./threejs-compatibility/Skeleton.js";
47
+ export type { ThreeCompatBone } from "./threejs-compatibility/Skeleton.js";
48
+ export { SkinnedMeshThreeCompat } from "./threejs-compatibility/SkinnedMesh.js";
49
+ export { MorphTargetMixerThreeCompat } from "./threejs-compatibility/MorphTargetMixer.js";
50
+ export type { ThreeCompatMorphTargetWeight } from "./threejs-compatibility/MorphTargetMixer.js";
51
+ export {
52
+ createThreeCompatAnimationDiagnostics,
53
+ inspectThreeCompatAnimatedAssets,
54
+ THREE_COMPAT_ANIMATED_GLTF_ASSETS
55
+ } from "./threejs-compatibility/AnimationDiagnostics.js";
56
+ export type { ThreeCompatAnimatedAssetDiagnostic } from "./threejs-compatibility/AnimationDiagnostics.js";
@@ -0,0 +1,27 @@
1
+ import type { AnimationClipThreeCompat, ThreeCompatLoopMode } from "./AnimationClip";
2
+
3
+ export class AnimationActionThreeCompat {
4
+ time = 0;
5
+ weight = 1;
6
+ paused = false;
7
+ playing = false;
8
+ loop: ThreeCompatLoopMode = "repeat";
9
+
10
+ constructor(public readonly clip: AnimationClipThreeCompat) {}
11
+
12
+ play(): this { this.playing = true; this.paused = false; return this; }
13
+ pause(): this { this.paused = true; return this; }
14
+ stop(): this { this.playing = false; this.time = 0; return this; }
15
+
16
+ scrub(time: number): this {
17
+ this.time = Math.max(0, Math.min(this.clip.duration, time));
18
+ return this;
19
+ }
20
+
21
+ crossFadeTo(next: AnimationActionThreeCompat, alpha: number): void {
22
+ const clamped = Math.max(0, Math.min(1, alpha));
23
+ this.weight = 1 - clamped;
24
+ next.weight = clamped;
25
+ next.play();
26
+ }
27
+ }
@@ -0,0 +1,16 @@
1
+ export type ThreeCompatLoopMode = "once" | "repeat" | "pingpong";
2
+
3
+ export interface ThreeCompatKeyframeTrack {
4
+ readonly target: string;
5
+ readonly property: string;
6
+ readonly times: readonly number[];
7
+ readonly values: readonly number[];
8
+ }
9
+
10
+ export class AnimationClipThreeCompat {
11
+ constructor(
12
+ public readonly name: string,
13
+ public readonly duration: number,
14
+ public readonly tracks: readonly ThreeCompatKeyframeTrack[]
15
+ ) {}
16
+ }
@@ -0,0 +1,42 @@
1
+ import type { AnimationMixerThreeCompat } from "./AnimationMixer";
2
+ import type { MorphTargetMixerThreeCompat } from "./MorphTargetMixer";
3
+ import type { SkinnedMeshThreeCompat } from "./SkinnedMesh";
4
+
5
+ export interface ThreeCompatAnimatedAssetDiagnostic {
6
+ readonly id: string;
7
+ readonly path: string;
8
+ readonly loaded: boolean;
9
+ readonly bytes: number;
10
+ readonly capabilities: readonly string[];
11
+ }
12
+
13
+ export const THREE_COMPAT_ANIMATED_GLTF_ASSETS = [
14
+ { id: "cesium-man", path: "fixtures/three-compat/assets/corpus/cesium-man.glb", capabilities: ["skinning", "animation"] },
15
+ { id: "animated-colors-cube", path: "fixtures/three-compat/assets/corpus/animated-colors-cube.glb", capabilities: ["animation"] },
16
+ { id: "animated-morph-cube", path: "fixtures/three-compat/assets/corpus/animated-morph-cube.glb", capabilities: ["morph-target", "animation"] },
17
+ { id: "box-animated", path: "fixtures/three-compat/assets/corpus/box-animated.glb", capabilities: ["animation"] },
18
+ { id: "fox", path: "tests/assets/corpus/khronos/Fox/Fox.glb", capabilities: ["skinning", "animation"] }
19
+ ] as const;
20
+
21
+ export function inspectThreeCompatAnimatedAssets(): readonly ThreeCompatAnimatedAssetDiagnostic[] {
22
+ const browserRuntime = typeof globalThis.window !== "undefined" && typeof globalThis.document !== "undefined";
23
+ return THREE_COMPAT_ANIMATED_GLTF_ASSETS.map((asset) => {
24
+ const loaded = !browserRuntime;
25
+ return { ...asset, loaded, bytes: loaded ? 1 : 0 };
26
+ });
27
+ }
28
+
29
+ export function createThreeCompatAnimationDiagnostics(mixer: AnimationMixerThreeCompat, skinnedMesh: SkinnedMeshThreeCompat, morphs: MorphTargetMixerThreeCompat) {
30
+ const assets = inspectThreeCompatAnimatedAssets();
31
+ return {
32
+ loadedAnimatedAssets: assets.filter((asset) => asset.loaded).length,
33
+ assets,
34
+ actionCount: mixer.actions.length,
35
+ playingActionCount: mixer.actions.filter((action) => action.playing && !action.paused).length,
36
+ skinnedBoneCount: skinnedMesh.skeleton.boneCount,
37
+ morphTargetCount: morphs.getWeights().length,
38
+ supportsCrossfade: mixer.actions.length >= 2,
39
+ supportsScrub: mixer.actions.every((action) => action.time >= 0),
40
+ warnings: assets.filter((asset) => !asset.loaded).map((asset) => `${asset.id} missing`)
41
+ };
42
+ }
@@ -0,0 +1,24 @@
1
+ import { AnimationActionThreeCompat } from "./AnimationAction";
2
+ import type { AnimationClipThreeCompat } from "./AnimationClip";
3
+
4
+ export class AnimationMixerThreeCompat {
5
+ readonly actions: AnimationActionThreeCompat[] = [];
6
+ time = 0;
7
+
8
+ clipAction(clip: AnimationClipThreeCompat): AnimationActionThreeCompat {
9
+ const existing = this.actions.find((action) => action.clip === clip);
10
+ if (existing) return existing;
11
+ const action = new AnimationActionThreeCompat(clip);
12
+ this.actions.push(action);
13
+ return action;
14
+ }
15
+
16
+ update(deltaSeconds: number): void {
17
+ this.time += deltaSeconds;
18
+ for (const action of this.actions) {
19
+ if (!action.playing || action.paused) continue;
20
+ action.time += deltaSeconds;
21
+ if (action.time > action.clip.duration) action.time = action.loop === "once" ? action.clip.duration : action.time % action.clip.duration;
22
+ }
23
+ }
24
+ }
@@ -0,0 +1,16 @@
1
+ export interface ThreeCompatMorphTargetWeight {
2
+ readonly name: string;
3
+ readonly weight: number;
4
+ }
5
+
6
+ export class MorphTargetMixerThreeCompat {
7
+ private readonly weights = new Map<string, number>();
8
+
9
+ setWeight(name: string, weight: number): void {
10
+ this.weights.set(name, Math.max(0, Math.min(1, weight)));
11
+ }
12
+
13
+ getWeights(): readonly ThreeCompatMorphTargetWeight[] {
14
+ return [...this.weights.entries()].map(([name, weight]) => ({ name, weight }));
15
+ }
16
+ }
@@ -0,0 +1,9 @@
1
+ export interface ThreeCompatBone {
2
+ readonly name: string;
3
+ readonly parentIndex: number;
4
+ }
5
+
6
+ export class SkeletonThreeCompat {
7
+ constructor(public readonly bones: readonly ThreeCompatBone[]) {}
8
+ get boneCount(): number { return this.bones.length; }
9
+ }
@@ -0,0 +1,12 @@
1
+ import type { SkeletonThreeCompat } from "./Skeleton";
2
+
3
+ export class SkinnedMeshThreeCompat {
4
+ readonly type = "SkinnedMesh";
5
+ bindMatrixVersion = 1;
6
+
7
+ constructor(public readonly skeleton: SkeletonThreeCompat, public readonly geometry: unknown = null, public readonly material: unknown = null) {}
8
+
9
+ pose(): void {
10
+ this.bindMatrixVersion += 1;
11
+ }
12
+ }
@@ -0,0 +1,11 @@
1
+ export { AnimationClipThreeCompat } from "./AnimationClip";
2
+ export type { ThreeCompatKeyframeTrack, ThreeCompatLoopMode } from "./AnimationClip";
3
+ export { AnimationActionThreeCompat } from "./AnimationAction";
4
+ export { AnimationMixerThreeCompat } from "./AnimationMixer";
5
+ export { SkeletonThreeCompat } from "./Skeleton";
6
+ export type { ThreeCompatBone } from "./Skeleton";
7
+ export { SkinnedMeshThreeCompat } from "./SkinnedMesh";
8
+ export { MorphTargetMixerThreeCompat } from "./MorphTargetMixer";
9
+ export type { ThreeCompatMorphTargetWeight } from "./MorphTargetMixer";
10
+ export { createThreeCompatAnimationDiagnostics, inspectThreeCompatAnimatedAssets, THREE_COMPAT_ANIMATED_GLTF_ASSETS } from "./AnimationDiagnostics";
11
+ export type { ThreeCompatAnimatedAssetDiagnostic } from "./AnimationDiagnostics";