@vived/component-abb-6700 1.0.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 (203) hide show
  1. package/.todo.md +13 -0
  2. package/README.md +122 -0
  3. package/dist/.gitkeep +0 -0
  4. package/dist/Adapters/aBB6700PMAdapter.d.ts +10 -0
  5. package/dist/Adapters/aBB6700PMAdapter.d.ts.map +1 -0
  6. package/dist/Controllers/createABB6700.d.ts +12 -0
  7. package/dist/Controllers/createABB6700.d.ts.map +1 -0
  8. package/dist/Controllers/getPose.d.ts +11 -0
  9. package/dist/Controllers/getPose.d.ts.map +1 -0
  10. package/dist/Controllers/setJointAngle.d.ts +12 -0
  11. package/dist/Controllers/setJointAngle.d.ts.map +1 -0
  12. package/dist/Controllers/setPose.d.ts +11 -0
  13. package/dist/Controllers/setPose.d.ts.map +1 -0
  14. package/dist/Entities/ABB6700Entity.d.ts +35 -0
  15. package/dist/Entities/ABB6700Entity.d.ts.map +1 -0
  16. package/dist/Entities/ABB6700Repo.d.ts +32 -0
  17. package/dist/Entities/ABB6700Repo.d.ts.map +1 -0
  18. package/dist/Factory/ABB6700FeatureFactory.d.ts +26 -0
  19. package/dist/Factory/ABB6700FeatureFactory.d.ts.map +1 -0
  20. package/dist/Mocks/MockABB6700PM.d.ts +11 -0
  21. package/dist/Mocks/MockABB6700PM.d.ts.map +1 -0
  22. package/dist/Mocks/MockSetJointAngleUC.d.ts +7 -0
  23. package/dist/Mocks/MockSetJointAngleUC.d.ts.map +1 -0
  24. package/dist/Mocks/MockSetPoseUC.d.ts +7 -0
  25. package/dist/Mocks/MockSetPoseUC.d.ts.map +1 -0
  26. package/dist/PMs/ABB6700PM.d.ts +32 -0
  27. package/dist/PMs/ABB6700PM.d.ts.map +1 -0
  28. package/dist/UCs/CalcStabilizerUC.d.ts +7 -0
  29. package/dist/UCs/CalcStabilizerUC.d.ts.map +1 -0
  30. package/dist/UCs/SetJointAngleUC.d.ts +15 -0
  31. package/dist/UCs/SetJointAngleUC.d.ts.map +1 -0
  32. package/dist/UCs/SetPoseUC.d.ts +22 -0
  33. package/dist/UCs/SetPoseUC.d.ts.map +1 -0
  34. package/dist/Views/ABB6700BabylonView.d.ts +27 -0
  35. package/dist/Views/ABB6700BabylonView.d.ts.map +1 -0
  36. package/dist/abb_6700.glb +0 -0
  37. package/dist/abstractAudioBus-CyBWsmuN.js +14 -0
  38. package/dist/animationGroup-BhNThqQe.js +1454 -0
  39. package/dist/basisTextureLoader-BT391BsV.js +310 -0
  40. package/dist/brdfTextureTools-DUyKBAXf.js +79 -0
  41. package/dist/bumpFragment-Dd-ojPA1.js +134 -0
  42. package/dist/bumpFragment-KE1_PuMl.js +287 -0
  43. package/dist/bumpVertex-BcdvVFVx.js +8 -0
  44. package/dist/bumpVertexDeclaration-B5Uvs-RS.js +8 -0
  45. package/dist/bumpVertexDeclaration-ixSg-yGI.js +8 -0
  46. package/dist/clipPlaneFragment-DJwQynjA.js +136 -0
  47. package/dist/clipPlaneVertex-D4Wk50XG.js +376 -0
  48. package/dist/clipPlaneVertex-eQ147Tn2.js +350 -0
  49. package/dist/component.config.d.ts +17 -0
  50. package/dist/component.config.d.ts.map +1 -0
  51. package/dist/ddsTextureLoader-DeoF3iGO.js +331 -0
  52. package/dist/default.fragment-DKnTR9nY.js +548 -0
  53. package/dist/default.fragment-rIGWrUS5.js +486 -0
  54. package/dist/default.vertex-Bt5y1VyA.js +212 -0
  55. package/dist/default.vertex-Dext1liJ.js +224 -0
  56. package/dist/defaultUboDeclaration-BwslQZX8.js +11 -0
  57. package/dist/defaultUboDeclaration-DSXACgip.js +9 -0
  58. package/dist/easing-BAt0SO-B.js +163 -0
  59. package/dist/envTextureLoader-CBiW_Q-U.js +40 -0
  60. package/dist/exrTextureLoader-5SC6PKIA.js +740 -0
  61. package/dist/flowGraphApplyForceBlock-6e8-wcaw.js +32 -0
  62. package/dist/flowGraphApplyImpulseBlock-B27EZQow.js +32 -0
  63. package/dist/flowGraphArrayIndexBlock-DIUn5e4i.js +31 -0
  64. package/dist/flowGraphBezierCurveEasingBlock-BJmiHk40.js +25 -0
  65. package/dist/flowGraphBinaryOperationBlock-Bj7TANCc.js +25 -0
  66. package/dist/flowGraphBranchBlock-7CRvIKWc.js +19 -0
  67. package/dist/flowGraphCachedOperationBlock-CP1ZiuIB.js +26 -0
  68. package/dist/flowGraphCancelDelayBlock-DqtgzBGm.js +20 -0
  69. package/dist/flowGraphCodeExecutionBlock-CaYXCGqo.js +23 -0
  70. package/dist/flowGraphConditionalDataBlock-DJ7evX8_.js +28 -0
  71. package/dist/flowGraphConsoleLogBlock-cMkpqLzO.js +68 -0
  72. package/dist/flowGraphConstantBlock-JWybwT0A.js +28 -0
  73. package/dist/flowGraphContextBlock-CFDXHcbn.js +19 -0
  74. package/dist/flowGraphCounterBlock-B0uPkgw9.js +24 -0
  75. package/dist/flowGraphDataSwitchBlock-B0GSifvJ.js +27 -0
  76. package/dist/flowGraphDebounceBlock-CSw8zKym.js +24 -0
  77. package/dist/flowGraphDebugBlock-DiSR6Ahn.js +65 -0
  78. package/dist/flowGraphDoNBlock-C-48oQ2H.js +24 -0
  79. package/dist/flowGraphEasingBlock-DKUaE7Rp.js +50 -0
  80. package/dist/flowGraphFlipFlopBlock-DX5BGhMV.js +20 -0
  81. package/dist/flowGraphForLoopBlock-Di-Qwg23.js +27 -0
  82. package/dist/flowGraphFunctionReferenceBlock-D8X5TFsO.js +20 -0
  83. package/dist/flowGraphGLTFDataProvider-C4j7nPQv.js +16 -0
  84. package/dist/flowGraphGetAngularVelocityBlock-Cq-yTQ4D.js +31 -0
  85. package/dist/flowGraphGetAssetBlock-B36eioor.js +21 -0
  86. package/dist/flowGraphGetLinearVelocityBlock-MdrV0eUD.js +31 -0
  87. package/dist/flowGraphGetPhysicsMassPropertiesBlock-wXDZP1wM.js +30 -0
  88. package/dist/flowGraphGetPropertyBlock-eP0badwf.js +46 -0
  89. package/dist/flowGraphGetSoundVolumeBlock-D3gXGHXa.js +29 -0
  90. package/dist/flowGraphGetVariableBlock-C7-qZAec.js +31 -0
  91. package/dist/flowGraphIndexOfBlock-CC5l9n9P.js +31 -0
  92. package/dist/flowGraphInterpolationBlock-B6922jzt.js +50 -0
  93. package/dist/flowGraphIsKeyPressedBlock-X_iuiUOX.js +31 -0
  94. package/dist/flowGraphIsSoundPlayingBlock-DONQX8N8.js +29 -0
  95. package/dist/flowGraphJsonPointerParserBlock-DBH_gN8I.js +95 -0
  96. package/dist/flowGraphKeyDownEventBlock-D5T1Uyfv.js +26 -0
  97. package/dist/flowGraphKeyUpEventBlock-BPY_Kgkm.js +21 -0
  98. package/dist/flowGraphKeyboardEventBlock-C49fx3TC.js +20 -0
  99. package/dist/flowGraphMathBlocks-CkvrN3VJ.js +864 -0
  100. package/dist/flowGraphMathCombineExtractBlocks-QSjGlnoz.js +248 -0
  101. package/dist/flowGraphMatrixMathBlocks-B3D7Cz9p.js +117 -0
  102. package/dist/flowGraphMeshPickEventBlock-BBTz-taa.js +35 -0
  103. package/dist/flowGraphMultiGateBlock-BhY1y5BG.js +50 -0
  104. package/dist/flowGraphPauseAnimationBlock-CHZZXMbg.js +19 -0
  105. package/dist/flowGraphPauseSoundBlock-B7hMmJ0c.js +31 -0
  106. package/dist/flowGraphPhysicsCollisionEventBlock-CxoPpT-q.js +56 -0
  107. package/dist/flowGraphPlayAnimationBlock-DVAvIFux.js +99 -0
  108. package/dist/flowGraphPlaySoundBlock-DjHGrqbC.js +32 -0
  109. package/dist/flowGraphPointerDownEventBlock-qI-H0JST.js +31 -0
  110. package/dist/flowGraphPointerMoveEventBlock-DAi4VUyy.js +31 -0
  111. package/dist/flowGraphPointerOutEventBlock-CFtj68aC.js +21 -0
  112. package/dist/flowGraphPointerOverEventBlock-VxdHhFuu.js +23 -0
  113. package/dist/flowGraphPointerUpEventBlock-DRR1f07q.js +31 -0
  114. package/dist/flowGraphReceiveCustomEventBlock-B3bwdB66.js +52 -0
  115. package/dist/flowGraphSceneReadyEventBlock-Dy6lDT3j.js +23 -0
  116. package/dist/flowGraphSceneTickEventBlock-Bl9BF_Xw.js +32 -0
  117. package/dist/flowGraphSendCustomEventBlock-BAR4PGFq.js +35 -0
  118. package/dist/flowGraphSequenceBlock-veqU32ZZ.js +32 -0
  119. package/dist/flowGraphSetAngularVelocityBlock-Dj9b-zu6.js +31 -0
  120. package/dist/flowGraphSetDelayBlock-CMjudtvk.js +131 -0
  121. package/dist/flowGraphSetLinearVelocityBlock-DVDhhJBd.js +31 -0
  122. package/dist/flowGraphSetPhysicsMotionTypeBlock-CL3cxNCO.js +36 -0
  123. package/dist/flowGraphSetPropertyBlock-D3sWL3Ss.js +47 -0
  124. package/dist/flowGraphSetSoundVolumeBlock-CxVk45yR.js +32 -0
  125. package/dist/flowGraphSetVariableBlock-D1oJiwLj.js +47 -0
  126. package/dist/flowGraphSoundEndedEventBlock-CubEwii0.js +47 -0
  127. package/dist/flowGraphStopAnimationBlock-B9inwIQx.js +48 -0
  128. package/dist/flowGraphStopSoundBlock-BijIX2jC.js +31 -0
  129. package/dist/flowGraphSwitchBlock-BMhPb4OX.js +54 -0
  130. package/dist/flowGraphThrottleBlock-C7vrnkb1.js +37 -0
  131. package/dist/flowGraphTransformCoordinatesSystemBlock-DoISqaUG.js +29 -0
  132. package/dist/flowGraphTypeToTypeBlocks-CSML6QWx.js +57 -0
  133. package/dist/flowGraphUnaryOperationBlock-B0Shf-lJ.js +24 -0
  134. package/dist/flowGraphVectorMathBlocks-DoTRR_E0.js +178 -0
  135. package/dist/flowGraphWaitAllBlock-BvmDMc24.js +54 -0
  136. package/dist/flowGraphWhileLoopBlock-BaIq4-K2.js +27 -0
  137. package/dist/geometry.fragment-Bsis3UG2.js +275 -0
  138. package/dist/geometry.vertex-DskQ5b8j.js +222 -0
  139. package/dist/harmonicsFunctions-CtNrRfir.js +193 -0
  140. package/dist/harmonicsFunctions-PEz6APC7.js +18 -0
  141. package/dist/hdrTextureLoader-D9rYxJ9q.js +112 -0
  142. package/dist/helperFunctions-Bt7Zfkrp.js +89 -0
  143. package/dist/helperFunctions-CPmRxd37.js +121 -0
  144. package/dist/iesTextureLoader-BGUFjVhI.js +93 -0
  145. package/dist/index-CS3Icp_r.js +67657 -0
  146. package/dist/index.d.ts +23 -0
  147. package/dist/index.d.ts.map +1 -0
  148. package/dist/index.js +27 -0
  149. package/dist/ktxTextureLoader-cUaGg9_L.js +459 -0
  150. package/dist/lightFragment-BRDibDKG.js +404 -0
  151. package/dist/lightFragment-DCqtGMp_.js +402 -0
  152. package/dist/logDepthDeclaration-Bwm-3KyB.js +16 -0
  153. package/dist/logDepthDeclaration-gUfeSnXX.js +20 -0
  154. package/dist/logDepthVertex-CKeuJ6ae.js +213 -0
  155. package/dist/logDepthVertex-CXkmZels.js +459 -0
  156. package/dist/mesh.vertexData.functions-Bc9lJlrU.js +74 -0
  157. package/dist/oitFragment-B8zuQigp.js +792 -0
  158. package/dist/oitFragment-DH3h3T6x.js +657 -0
  159. package/dist/openpbr.fragment-BglYS6LA.js +1405 -0
  160. package/dist/openpbr.fragment-DrOTZs4m.js +1553 -0
  161. package/dist/openpbr.vertex-B-PaLFOR.js +384 -0
  162. package/dist/openpbr.vertex-DMdFRTnX.js +268 -0
  163. package/dist/openpbrMaterial-HCU0aOca.js +2880 -0
  164. package/dist/openpbrMaterialLoadingAdapter-CWRAa-7S.js +1122 -0
  165. package/dist/openpbrTransmissionLayerData-CfDVObj5.js +352 -0
  166. package/dist/openpbrUboDeclaration-CA2pvSbt.js +9 -0
  167. package/dist/openpbrUboDeclaration-xU8VOaib.js +10 -0
  168. package/dist/pass.fragment-1mMP54bb.js +10 -0
  169. package/dist/pass.fragment-DzaUp_jk.js +10 -0
  170. package/dist/passCube.fragment-CQaXS7g3.js +29 -0
  171. package/dist/passCube.fragment-QJGPwAXI.js +29 -0
  172. package/dist/pbr.fragment-BnaAAGxb.js +2775 -0
  173. package/dist/pbr.fragment-CYZk_EGU.js +2619 -0
  174. package/dist/pbr.vertex-CyvdCw91.js +372 -0
  175. package/dist/pbr.vertex-DJMAkDxs.js +270 -0
  176. package/dist/pbrBRDFFunctions-EugoWm6O.js +175 -0
  177. package/dist/pbrDebug-Bk3sPoEG.js +719 -0
  178. package/dist/pbrDebug-Cdalzb1I.js +614 -0
  179. package/dist/pbrIBLFunctions-B0bVAXCF.js +47 -0
  180. package/dist/pbrIBLFunctions-C06z-ouZ.js +51 -0
  181. package/dist/pbrMaterial-C4FCKBZQ.js +1660 -0
  182. package/dist/pbrMaterialLoadingAdapter-BGHlS_ZN.js +1032 -0
  183. package/dist/pbrUboDeclaration-1lN5_-Bw.js +9 -0
  184. package/dist/pbrUboDeclaration-BJOUUOZ2.js +10 -0
  185. package/dist/procedural.vertex-CFPKczKj.js +14 -0
  186. package/dist/procedural.vertex-DUW7bYZt.js +13 -0
  187. package/dist/rgbdDecode.fragment-CEGgE4tL.js +8 -0
  188. package/dist/rgbdDecode.fragment-FT0wkgah.js +8 -0
  189. package/dist/rgbdEncode.fragment-CLnJJf6E.js +8 -0
  190. package/dist/rgbdEncode.fragment-CaAcMsY9.js +8 -0
  191. package/dist/sceneUboDeclaration-B6oxsfcj.js +8 -0
  192. package/dist/sceneUboDeclaration-JByfVKik.js +13 -0
  193. package/dist/setupABB6700InstanceFactory.d.ts +7 -0
  194. package/dist/setupABB6700InstanceFactory.d.ts.map +1 -0
  195. package/dist/studio.env +0 -0
  196. package/dist/textureProcessor.fragment-BYPw6SMQ.js +152 -0
  197. package/dist/textureProcessor.fragment-Ciw9-F3w.js +157 -0
  198. package/dist/textureTools-Cct_bGgp.js +40 -0
  199. package/dist/tgaTextureLoader-BJOIdnFr.js +198 -0
  200. package/dist/thinEngine-Bt9FW4dD.js +2425 -0
  201. package/dist/webAudioBus-BUzRHSxr.js +88 -0
  202. package/dist/webAudioMainBus-Dds1TgJG.js +49 -0
  203. package/package.json +49 -0
@@ -0,0 +1,1454 @@
1
+ import { i as A, ad as F, bt as x, bs as E, bv as R, bw as M, bx as N, bu as B, am as C, ai as P, b8 as T, aJ as S, bf as k, w as D, aY as W, K, b3 as w, bb as U } from "./index-CS3Icp_r.js";
2
+ class Y {
3
+ /**
4
+ * Gets the current frame of the runtime animation
5
+ */
6
+ get currentFrame() {
7
+ return this._currentFrame;
8
+ }
9
+ /**
10
+ * Gets the weight of the runtime animation
11
+ */
12
+ get weight() {
13
+ return this._weight;
14
+ }
15
+ /**
16
+ * Gets the current value of the runtime animation
17
+ */
18
+ get currentValue() {
19
+ return this._currentValue;
20
+ }
21
+ /**
22
+ * Gets or sets the target path of the runtime animation
23
+ */
24
+ get targetPath() {
25
+ return this._targetPath;
26
+ }
27
+ /**
28
+ * Gets the actual target of the runtime animation
29
+ */
30
+ get target() {
31
+ return this._currentActiveTarget;
32
+ }
33
+ /**
34
+ * Gets the additive state of the runtime animation
35
+ */
36
+ get isAdditive() {
37
+ return this._host && this._host.isAdditive;
38
+ }
39
+ /**
40
+ * Create a new RuntimeAnimation object
41
+ * @param target defines the target of the animation
42
+ * @param animation defines the source animation object
43
+ * @param scene defines the hosting scene
44
+ * @param host defines the initiating Animatable
45
+ */
46
+ constructor(t, e, i, n) {
47
+ if (this._events = new Array(), this._currentFrame = 0, this._originalValue = new Array(), this._originalBlendValue = null, this._offsetsCache = {}, this._highLimitsCache = {}, this._stopped = !1, this._blendingFactor = 0, this._currentValue = null, this._currentActiveTarget = null, this._directTarget = null, this._targetPath = "", this._weight = 1, this._absoluteFrameOffset = 0, this._previousElapsedTime = 0, this._yoyoDirection = 1, this._previousAbsoluteFrame = 0, this._targetIsArray = !1, this._coreRuntimeAnimation = null, this._animation = e, this._target = t, this._scene = i, this._host = n, this._activeTargets = [], e._runtimeAnimations.push(this), this._animationState = {
48
+ key: 0,
49
+ repeatCount: 0,
50
+ loopMode: this._getCorrectLoopMode()
51
+ }, this._animation.dataType === A.ANIMATIONTYPE_MATRIX && (this._animationState.workValue = F.Zero()), this._keys = this._animation.getKeys(), this._minFrame = this._keys[0].frame, this._maxFrame = this._keys[this._keys.length - 1].frame, this._minFrame !== 0) {
52
+ const a = { frame: 0, value: this._keys[0].value };
53
+ this._keys.splice(0, 0, a);
54
+ }
55
+ if (this._target instanceof Array) {
56
+ let a = 0;
57
+ for (const r of this._target)
58
+ this._preparePath(r, a), this._getOriginalValues(a), a++;
59
+ this._targetIsArray = !0;
60
+ } else
61
+ this._preparePath(this._target), this._getOriginalValues(), this._targetIsArray = !1, this._directTarget = this._activeTargets[0];
62
+ const s = e.getEvents();
63
+ if (s && s.length > 0)
64
+ for (const a of s)
65
+ this._events.push(a._clone());
66
+ this._enableBlending = t && t.animationPropertiesOverride ? t.animationPropertiesOverride.enableBlending : this._animation.enableBlending;
67
+ }
68
+ _preparePath(t, e = 0) {
69
+ const i = this._animation.targetPropertyPath;
70
+ if (i.length > 1) {
71
+ let n = t;
72
+ for (let s = 0; s < i.length - 1; s++) {
73
+ const a = i[s];
74
+ if (n = n[a], n === void 0)
75
+ throw new Error(`Invalid property (${a}) in property path (${i.join(".")})`);
76
+ }
77
+ this._targetPath = i[i.length - 1], this._activeTargets[e] = n;
78
+ } else
79
+ this._targetPath = i[0], this._activeTargets[e] = t;
80
+ if (this._activeTargets[e][this._targetPath] === void 0)
81
+ throw new Error(`Invalid property (${this._targetPath}) in property path (${i.join(".")})`);
82
+ }
83
+ /**
84
+ * Gets the animation from the runtime animation
85
+ */
86
+ get animation() {
87
+ return this._animation;
88
+ }
89
+ /**
90
+ * Resets the runtime animation to the beginning
91
+ * @param restoreOriginal defines whether to restore the target property to the original value
92
+ */
93
+ reset(t = !1) {
94
+ if (t)
95
+ if (this._target instanceof Array) {
96
+ let e = 0;
97
+ for (const i of this._target)
98
+ this._originalValue[e] !== void 0 && this._setValue(i, this._activeTargets[e], this._originalValue[e], -1, e), e++;
99
+ } else
100
+ this._originalValue[0] !== void 0 && this._setValue(this._target, this._directTarget, this._originalValue[0], -1, 0);
101
+ this._offsetsCache = {}, this._highLimitsCache = {}, this._currentFrame = 0, this._blendingFactor = 0;
102
+ for (let e = 0; e < this._events.length; e++)
103
+ this._events[e].isDone = !1;
104
+ }
105
+ /**
106
+ * Specifies if the runtime animation is stopped
107
+ * @returns Boolean specifying if the runtime animation is stopped
108
+ */
109
+ isStopped() {
110
+ return this._stopped;
111
+ }
112
+ /**
113
+ * Disposes of the runtime animation
114
+ */
115
+ dispose() {
116
+ const t = this._animation.runtimeAnimations.indexOf(this);
117
+ t > -1 && this._animation.runtimeAnimations.splice(t, 1);
118
+ }
119
+ /**
120
+ * Apply the interpolated value to the target
121
+ * @param currentValue defines the value computed by the animation
122
+ * @param weight defines the weight to apply to this value (Defaults to 1.0)
123
+ */
124
+ setValue(t, e) {
125
+ if (this._targetIsArray) {
126
+ for (let i = 0; i < this._target.length; i++) {
127
+ const n = this._target[i];
128
+ this._setValue(n, this._activeTargets[i], t, e, i);
129
+ }
130
+ return;
131
+ }
132
+ this._setValue(this._target, this._directTarget, t, e, 0);
133
+ }
134
+ _getOriginalValues(t = 0) {
135
+ let e;
136
+ const i = this._activeTargets[t];
137
+ if (A.InheritOriginalValueFromActiveAnimations) {
138
+ const n = this._scene._activeAnimatables;
139
+ for (let s = 0; s < n.length; s++) {
140
+ const a = n[s]._runtimeAnimations;
141
+ for (let r = 0; r < a.length; r++) {
142
+ const o = a[r];
143
+ if (o !== this && o._targetPath === this._targetPath) {
144
+ for (let l = 0; l < o._activeTargets.length; l++)
145
+ if (o._activeTargets[l] === i && o._originalValue[l] !== void 0) {
146
+ o._originalValue[l] && o._originalValue[l].clone ? this._originalValue[t] = o._originalValue[l].clone() : this._originalValue[t] = o._originalValue[l];
147
+ return;
148
+ }
149
+ }
150
+ }
151
+ }
152
+ }
153
+ i.getLocalMatrix && this._targetPath === "_matrix" ? e = i.getLocalMatrix() : e = i[this._targetPath], e && e.clone ? this._originalValue[t] = e.clone() : this._originalValue[t] = e;
154
+ }
155
+ _registerTargetForLateAnimationBinding(t, e) {
156
+ const i = t.target;
157
+ this._scene._registeredForLateAnimationBindings.pushNoDuplicate(i), i._lateAnimationHolders || (i._lateAnimationHolders = {}), i._lateAnimationHolders[t.targetPath] || (i._lateAnimationHolders[t.targetPath] = {
158
+ totalWeight: 0,
159
+ totalAdditiveWeight: 0,
160
+ animations: [],
161
+ additiveAnimations: [],
162
+ originalValue: e
163
+ }), t.isAdditive ? (i._lateAnimationHolders[t.targetPath].additiveAnimations.push(t), i._lateAnimationHolders[t.targetPath].totalAdditiveWeight += t.weight) : (i._lateAnimationHolders[t.targetPath].animations.push(t), i._lateAnimationHolders[t.targetPath].totalWeight += t.weight);
164
+ }
165
+ _setValue(t, e, i, n, s) {
166
+ if (this._currentActiveTarget = e, this._weight = n, this._enableBlending && this._blendingFactor <= 1) {
167
+ if (!this._originalBlendValue) {
168
+ const r = e[this._targetPath];
169
+ r.clone ? this._originalBlendValue = r.clone() : this._originalBlendValue = r;
170
+ }
171
+ this._originalBlendValue.m ? A.AllowMatrixDecomposeForInterpolation ? this._currentValue ? F.DecomposeLerpToRef(this._originalBlendValue, i, this._blendingFactor, this._currentValue) : this._currentValue = F.DecomposeLerp(this._originalBlendValue, i, this._blendingFactor) : this._currentValue ? F.LerpToRef(this._originalBlendValue, i, this._blendingFactor, this._currentValue) : this._currentValue = F.Lerp(this._originalBlendValue, i, this._blendingFactor) : this._currentValue = A._UniversalLerp(this._originalBlendValue, i, this._blendingFactor);
172
+ const a = t && t.animationPropertiesOverride ? t.animationPropertiesOverride.blendingSpeed : this._animation.blendingSpeed;
173
+ this._blendingFactor += a;
174
+ } else
175
+ this._currentValue ? this._currentValue.copyFrom ? this._currentValue.copyFrom(i) : this._currentValue = i : i?.clone ? this._currentValue = i.clone() : this._currentValue = i;
176
+ n !== -1 ? this._registerTargetForLateAnimationBinding(this, this._originalValue[s]) : this._animationState.loopMode === A.ANIMATIONLOOPMODE_RELATIVE_FROM_CURRENT ? this._currentValue.addToRef ? this._currentValue.addToRef(this._originalValue[s], e[this._targetPath]) : e[this._targetPath] = this._originalValue[s] + this._currentValue : e[this._targetPath] = this._currentValue, t.markAsDirty && t.markAsDirty(this._animation.targetProperty);
177
+ }
178
+ /**
179
+ * Gets the loop pmode of the runtime animation
180
+ * @returns Loop Mode
181
+ */
182
+ _getCorrectLoopMode() {
183
+ return this._target && this._target.animationPropertiesOverride ? this._target.animationPropertiesOverride.loopMode : this._animation.loopMode;
184
+ }
185
+ /**
186
+ * Move the current animation to a given frame
187
+ * @param frame defines the frame to move to
188
+ * @param weight defines the weight to apply to the animation (-1.0 by default)
189
+ */
190
+ goToFrame(t, e = -1) {
191
+ const i = this._animation.getKeys();
192
+ t < i[0].frame ? t = i[0].frame : t > i[i.length - 1].frame && (t = i[i.length - 1].frame);
193
+ const n = this._events;
194
+ if (n.length)
195
+ for (let a = 0; a < n.length; a++)
196
+ n[a].onlyOnce || (n[a].isDone = n[a].frame < t);
197
+ this._currentFrame = t;
198
+ const s = this._animation._interpolate(t, this._animationState);
199
+ this.setValue(s, e);
200
+ }
201
+ /**
202
+ * @internal Internal use only
203
+ */
204
+ _prepareForSpeedRatioChange(t) {
205
+ const e = this._previousElapsedTime * (this._animation.framePerSecond * t) / 1e3;
206
+ this._absoluteFrameOffset = this._previousAbsoluteFrame - e;
207
+ }
208
+ /**
209
+ * Execute the current animation
210
+ * @param elapsedTimeSinceAnimationStart defines the elapsed time (in milliseconds) since the animation was started
211
+ * @param from defines the lower frame of the animation range
212
+ * @param to defines the upper frame of the animation range
213
+ * @param loop defines if the current animation must loop
214
+ * @param speedRatio defines the current speed ratio
215
+ * @param weight defines the weight of the animation (default is -1 so no weight)
216
+ * @returns a boolean indicating if the animation is running
217
+ */
218
+ animate(t, e, i, n, s, a = -1) {
219
+ const r = this._animation, o = r.targetPropertyPath;
220
+ if (!o || o.length < 1)
221
+ return this._stopped = !0, !1;
222
+ let l = !0, u;
223
+ const c = this._events;
224
+ let g;
225
+ if (this._coreRuntimeAnimation)
226
+ g = i - e, u = this._coreRuntimeAnimation.currentFrame, this._currentFrame = u, this._animationState.repeatCount = this._coreRuntimeAnimation._animationState.repeatCount, this._animationState.highLimitValue = this._coreRuntimeAnimation._animationState.highLimitValue, this._animationState.offsetValue = this._coreRuntimeAnimation._animationState.offsetValue;
227
+ else {
228
+ (e < this._minFrame || e > this._maxFrame) && (e = this._minFrame), (i < this._minFrame || i > this._maxFrame) && (i = this._maxFrame), g = i - e;
229
+ let _, m = t * (r.framePerSecond * s) / 1e3 + this._absoluteFrameOffset, b = 0, O = !1;
230
+ const v = n && this._animationState.loopMode === A.ANIMATIONLOOPMODE_YOYO;
231
+ if (v) {
232
+ const f = (m - e) / g, p = Math.sin(f * Math.PI);
233
+ m = Math.abs(p) * g + e;
234
+ const L = p >= 0 ? 1 : -1;
235
+ this._yoyoDirection !== L && (O = !0), this._yoyoDirection = L;
236
+ }
237
+ if (this._previousElapsedTime = t, this._previousAbsoluteFrame = m, !n && i >= e && (m >= g && s > 0 || m <= 0 && s < 0))
238
+ l = !1, b = r.evaluate(i);
239
+ else if (!n && e >= i && (m <= g && s < 0 || m >= 0 && s > 0))
240
+ l = !1, b = r.evaluate(e);
241
+ else if (this._animationState.loopMode !== A.ANIMATIONLOOPMODE_CYCLE) {
242
+ const f = i.toString() + e.toString();
243
+ if (!this._offsetsCache[f]) {
244
+ this._animationState.repeatCount = 0, this._animationState.loopMode = A.ANIMATIONLOOPMODE_CYCLE;
245
+ const p = r._interpolate(e, this._animationState), y = r._interpolate(i, this._animationState);
246
+ switch (this._animationState.loopMode = this._getCorrectLoopMode(), r.dataType) {
247
+ // Float
248
+ case A.ANIMATIONTYPE_FLOAT:
249
+ this._offsetsCache[f] = y - p;
250
+ break;
251
+ // Quaternion
252
+ case A.ANIMATIONTYPE_QUATERNION:
253
+ this._offsetsCache[f] = y.subtract(p);
254
+ break;
255
+ // Vector3
256
+ case A.ANIMATIONTYPE_VECTOR3:
257
+ this._offsetsCache[f] = y.subtract(p);
258
+ break;
259
+ // Vector2
260
+ case A.ANIMATIONTYPE_VECTOR2:
261
+ this._offsetsCache[f] = y.subtract(p);
262
+ break;
263
+ // Size
264
+ case A.ANIMATIONTYPE_SIZE:
265
+ this._offsetsCache[f] = y.subtract(p);
266
+ break;
267
+ // Color3
268
+ case A.ANIMATIONTYPE_COLOR3:
269
+ this._offsetsCache[f] = y.subtract(p);
270
+ break;
271
+ }
272
+ this._highLimitsCache[f] = y;
273
+ }
274
+ b = this._highLimitsCache[f], _ = this._offsetsCache[f];
275
+ }
276
+ if (_ === void 0)
277
+ switch (r.dataType) {
278
+ // Float
279
+ case A.ANIMATIONTYPE_FLOAT:
280
+ _ = 0;
281
+ break;
282
+ // Quaternion
283
+ case A.ANIMATIONTYPE_QUATERNION:
284
+ _ = B;
285
+ break;
286
+ // Vector3
287
+ case A.ANIMATIONTYPE_VECTOR3:
288
+ _ = N;
289
+ break;
290
+ // Vector2
291
+ case A.ANIMATIONTYPE_VECTOR2:
292
+ _ = M;
293
+ break;
294
+ // Size
295
+ case A.ANIMATIONTYPE_SIZE:
296
+ _ = R;
297
+ break;
298
+ // Color3
299
+ case A.ANIMATIONTYPE_COLOR3:
300
+ _ = E;
301
+ break;
302
+ case A.ANIMATIONTYPE_COLOR4:
303
+ _ = x;
304
+ break;
305
+ }
306
+ if (this._host && this._host.syncRoot) {
307
+ const f = this._host.syncRoot, p = (f.masterFrame - f.fromFrame) / (f.toFrame - f.fromFrame);
308
+ u = e + g * p;
309
+ } else
310
+ m > 0 && e > i || m < 0 && e < i ? u = l && g !== 0 ? i + m % g : e : u = l && g !== 0 ? e + m % g : i;
311
+ if (!v && (s > 0 && this.currentFrame > u || s < 0 && this.currentFrame < u) || v && O) {
312
+ this._onLoop();
313
+ for (let f = 0; f < c.length; f++)
314
+ c[f].onlyOnce || (c[f].isDone = !1);
315
+ this._animationState.key = s > 0 ? 0 : r.getKeys().length - 1;
316
+ }
317
+ this._currentFrame = u, this._animationState.repeatCount = g === 0 ? 0 : m / g >> 0, this._animationState.highLimitValue = b, this._animationState.offsetValue = _;
318
+ }
319
+ const d = r._interpolate(u, this._animationState);
320
+ if (this.setValue(d, a), c.length) {
321
+ for (let _ = 0; _ < c.length; _++)
322
+ if (g >= 0 && u >= c[_].frame && c[_].frame >= e || g < 0 && u <= c[_].frame && c[_].frame <= e) {
323
+ const m = c[_];
324
+ m.isDone || (m.onlyOnce && (c.splice(_, 1), _--), m.isDone = !0, m.action(u));
325
+ }
326
+ }
327
+ return l || (this._stopped = !0), l;
328
+ }
329
+ }
330
+ class I {
331
+ /**
332
+ * Gets the root Animatable used to synchronize and normalize animations
333
+ */
334
+ get syncRoot() {
335
+ return this._syncRoot;
336
+ }
337
+ /**
338
+ * Gets the current frame of the first RuntimeAnimation
339
+ * Used to synchronize Animatables
340
+ */
341
+ get masterFrame() {
342
+ return this._runtimeAnimations.length === 0 ? 0 : this._runtimeAnimations[0].currentFrame;
343
+ }
344
+ /**
345
+ * Gets or sets the animatable weight (-1.0 by default meaning not weighted)
346
+ */
347
+ get weight() {
348
+ return this._weight;
349
+ }
350
+ set weight(t) {
351
+ if (t === -1) {
352
+ this._weight = -1;
353
+ return;
354
+ }
355
+ this._weight = Math.min(Math.max(t, 0), 1);
356
+ }
357
+ /**
358
+ * Gets or sets the speed ratio to apply to the animatable (1.0 by default)
359
+ */
360
+ get speedRatio() {
361
+ return this._speedRatio;
362
+ }
363
+ set speedRatio(t) {
364
+ for (let e = 0; e < this._runtimeAnimations.length; e++)
365
+ this._runtimeAnimations[e]._prepareForSpeedRatioChange(t);
366
+ this._speedRatio = t, this._goToFrame !== null && this.goToFrame(this._goToFrame);
367
+ }
368
+ /**
369
+ * Gets the elapsed time since the animatable started in milliseconds
370
+ */
371
+ get elapsedTime() {
372
+ return this._localDelayOffset === null ? 0 : this._scene._animationTime - this._localDelayOffset;
373
+ }
374
+ /**
375
+ * Creates a new Animatable
376
+ * @param scene defines the hosting scene
377
+ * @param target defines the target object
378
+ * @param fromFrame defines the starting frame number (default is 0)
379
+ * @param toFrame defines the ending frame number (default is 100)
380
+ * @param loopAnimation defines if the animation must loop (default is false)
381
+ * @param speedRatio defines the factor to apply to animation speed (default is 1)
382
+ * @param onAnimationEnd defines a callback to call when animation ends if it is not looping
383
+ * @param animations defines a group of animation to add to the new Animatable
384
+ * @param onAnimationLoop defines a callback to call when animation loops
385
+ * @param isAdditive defines whether the animation should be evaluated additively
386
+ * @param playOrder defines the order in which this animatable should be processed in the list of active animatables (default: 0)
387
+ */
388
+ constructor(t, e, i = 0, n = 100, s = !1, a = 1, r, o, l, u = !1, c = 0) {
389
+ this.target = e, this.fromFrame = i, this.toFrame = n, this.loopAnimation = s, this.onAnimationEnd = r, this.onAnimationLoop = l, this.isAdditive = u, this.playOrder = c, this._localDelayOffset = null, this._pausedDelay = null, this._manualJumpDelay = null, this._runtimeAnimations = new Array(), this._paused = !1, this._speedRatio = 1, this._weight = -1, this._previousWeight = -1, this._syncRoot = null, this._frameToSyncFromJump = null, this._goToFrame = null, this.disposeOnEnd = !0, this.animationStarted = !1, this.onAnimationEndObservable = new P(), this.onAnimationLoopObservable = new P(), this._scene = t, o && this.appendAnimations(e, o), this._speedRatio = a, t._activeAnimatables.push(this);
390
+ }
391
+ // Methods
392
+ /**
393
+ * Synchronize and normalize current Animatable with a source Animatable
394
+ * This is useful when using animation weights and when animations are not of the same length
395
+ * @param root defines the root Animatable to synchronize with (null to stop synchronizing)
396
+ * @returns the current Animatable
397
+ */
398
+ syncWith(t) {
399
+ if (this._syncRoot = t, t) {
400
+ const e = this._scene._activeAnimatables.indexOf(this);
401
+ e > -1 && (this._scene._activeAnimatables.splice(e, 1), this._scene._activeAnimatables.push(this));
402
+ }
403
+ return this;
404
+ }
405
+ /**
406
+ * Gets the list of runtime animations
407
+ * @returns an array of RuntimeAnimation
408
+ */
409
+ getAnimations() {
410
+ return this._runtimeAnimations;
411
+ }
412
+ /**
413
+ * Adds more animations to the current animatable
414
+ * @param target defines the target of the animations
415
+ * @param animations defines the new animations to add
416
+ */
417
+ appendAnimations(t, e) {
418
+ for (let i = 0; i < e.length; i++) {
419
+ const n = e[i], s = new Y(t, n, this._scene, this);
420
+ s._onLoop = () => {
421
+ this.onAnimationLoopObservable.notifyObservers(this), this.onAnimationLoop && this.onAnimationLoop();
422
+ }, this._runtimeAnimations.push(s);
423
+ }
424
+ }
425
+ /**
426
+ * Gets the source animation for a specific property
427
+ * @param property defines the property to look for
428
+ * @returns null or the source animation for the given property
429
+ */
430
+ getAnimationByTargetProperty(t) {
431
+ const e = this._runtimeAnimations;
432
+ for (let i = 0; i < e.length; i++)
433
+ if (e[i].animation.targetProperty === t)
434
+ return e[i].animation;
435
+ return null;
436
+ }
437
+ /**
438
+ * Gets the runtime animation for a specific property
439
+ * @param property defines the property to look for
440
+ * @returns null or the runtime animation for the given property
441
+ */
442
+ getRuntimeAnimationByTargetProperty(t) {
443
+ const e = this._runtimeAnimations;
444
+ for (let i = 0; i < e.length; i++)
445
+ if (e[i].animation.targetProperty === t)
446
+ return e[i];
447
+ return null;
448
+ }
449
+ /**
450
+ * Resets the animatable to its original state
451
+ */
452
+ reset() {
453
+ const t = this._runtimeAnimations;
454
+ for (let e = 0; e < t.length; e++)
455
+ t[e].reset(!0);
456
+ this._localDelayOffset = null, this._pausedDelay = null;
457
+ }
458
+ /**
459
+ * Allows the animatable to blend with current running animations
460
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#animation-blending
461
+ * @param blendingSpeed defines the blending speed to use
462
+ */
463
+ enableBlending(t) {
464
+ const e = this._runtimeAnimations;
465
+ for (let i = 0; i < e.length; i++)
466
+ e[i].animation.enableBlending = !0, e[i].animation.blendingSpeed = t;
467
+ }
468
+ /**
469
+ * Disable animation blending
470
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#animation-blending
471
+ */
472
+ disableBlending() {
473
+ const t = this._runtimeAnimations;
474
+ for (let e = 0; e < t.length; e++)
475
+ t[e].animation.enableBlending = !1;
476
+ }
477
+ /**
478
+ * Jump directly to a given frame
479
+ * @param frame defines the frame to jump to
480
+ * @param useWeight defines whether the animation weight should be applied to the image to be jumped to (false by default)
481
+ */
482
+ goToFrame(t, e = !1) {
483
+ const i = this._runtimeAnimations;
484
+ if (i[0]) {
485
+ const n = i[0].animation.framePerSecond;
486
+ this._frameToSyncFromJump = this._frameToSyncFromJump ?? i[0].currentFrame;
487
+ const s = this.speedRatio === 0 ? 0 : (t - this._frameToSyncFromJump) / n * 1e3 / this.speedRatio;
488
+ this._manualJumpDelay = -s;
489
+ }
490
+ for (let n = 0; n < i.length; n++)
491
+ i[n].goToFrame(t, e ? this._weight : -1);
492
+ this._goToFrame = t;
493
+ }
494
+ /**
495
+ * Returns true if the animations for this animatable are paused
496
+ */
497
+ get paused() {
498
+ return this._paused;
499
+ }
500
+ /**
501
+ * Pause the animation
502
+ */
503
+ pause() {
504
+ this._paused || (this._paused = !0);
505
+ }
506
+ /**
507
+ * Restart the animation
508
+ */
509
+ restart() {
510
+ this._paused = !1;
511
+ }
512
+ _raiseOnAnimationEnd() {
513
+ this.onAnimationEnd && this.onAnimationEnd(), this.onAnimationEndObservable.notifyObservers(this);
514
+ }
515
+ /**
516
+ * Stop and delete the current animation
517
+ * @param animationName defines a string used to only stop some of the runtime animations instead of all
518
+ * @param targetMask a function that determines if the animation should be stopped based on its target (all animations will be stopped if both this and animationName are empty)
519
+ * @param useGlobalSplice if true, the animatables will be removed by the caller of this function (false by default)
520
+ * @param skipOnAnimationEnd defines if the system should not raise onAnimationEnd. Default is false
521
+ */
522
+ stop(t, e, i = !1, n = !1) {
523
+ if (t || e) {
524
+ const s = this._scene._activeAnimatables.indexOf(this);
525
+ if (s > -1) {
526
+ const a = this._runtimeAnimations;
527
+ for (let r = a.length - 1; r >= 0; r--) {
528
+ const o = a[r];
529
+ t && o.animation.name != t || e && !e(o.target) || (o.dispose(), a.splice(r, 1));
530
+ }
531
+ a.length == 0 && (i || this._scene._activeAnimatables.splice(s, 1), n || this._raiseOnAnimationEnd());
532
+ }
533
+ } else {
534
+ const s = this._scene._activeAnimatables.indexOf(this);
535
+ if (s > -1) {
536
+ i || this._scene._activeAnimatables.splice(s, 1);
537
+ const a = this._runtimeAnimations;
538
+ for (let r = 0; r < a.length; r++)
539
+ a[r].dispose();
540
+ this._runtimeAnimations.length = 0, n || this._raiseOnAnimationEnd();
541
+ }
542
+ }
543
+ }
544
+ /**
545
+ * Wait asynchronously for the animation to end
546
+ * @returns a promise which will be fulfilled when the animation ends
547
+ */
548
+ async waitAsync() {
549
+ return await new Promise((t) => {
550
+ this.onAnimationEndObservable.add(() => {
551
+ t(this);
552
+ }, void 0, void 0, this, !0);
553
+ });
554
+ }
555
+ /**
556
+ * @internal
557
+ */
558
+ _animate(t) {
559
+ if (this._paused)
560
+ return this.animationStarted = !1, this._pausedDelay === null && (this._pausedDelay = t), !0;
561
+ if (this._localDelayOffset === null ? (this._localDelayOffset = t, this._pausedDelay = null) : this._pausedDelay !== null && (this._localDelayOffset += t - this._pausedDelay, this._pausedDelay = null), this._manualJumpDelay !== null && (this._localDelayOffset += this.speedRatio < 0 ? -this._manualJumpDelay : this._manualJumpDelay, this._manualJumpDelay = null, this._frameToSyncFromJump = null), this._goToFrame = null, !I.ProcessPausedAnimatables && this._weight === 0 && this._previousWeight === 0)
562
+ return !0;
563
+ this._previousWeight = this._weight;
564
+ let e = !1;
565
+ const i = this._runtimeAnimations;
566
+ let n;
567
+ for (n = 0; n < i.length; n++) {
568
+ const a = i[n].animate(t - this._localDelayOffset, this.fromFrame, this.toFrame, this.loopAnimation, this._speedRatio, this._weight);
569
+ e = e || a;
570
+ }
571
+ if (this.animationStarted = e, !e) {
572
+ if (this.disposeOnEnd)
573
+ for (n = this._scene._activeAnimatables.indexOf(this), this._scene._activeAnimatables.splice(n, 1), n = 0; n < i.length; n++)
574
+ i[n].dispose();
575
+ this._raiseOnAnimationEnd(), this.disposeOnEnd && (this.onAnimationEnd = null, this.onAnimationLoop = null, this.onAnimationLoopObservable.clear(), this.onAnimationEndObservable.clear());
576
+ }
577
+ return e;
578
+ }
579
+ }
580
+ I.ProcessPausedAnimatables = !1;
581
+ function z(h) {
582
+ if (h.totalWeight === 0 && h.totalAdditiveWeight === 0)
583
+ return h.originalValue;
584
+ let t = 1;
585
+ const e = T.Vector3[0], i = T.Vector3[1], n = T.Quaternion[0];
586
+ let s = 0;
587
+ const a = h.animations[0], r = h.originalValue;
588
+ let o, l = !1;
589
+ if (h.totalWeight < 1)
590
+ o = 1 - h.totalWeight, r.decompose(i, n, e);
591
+ else {
592
+ if (s = 1, t = h.totalWeight, o = a.weight / t, o == 1)
593
+ if (h.totalAdditiveWeight)
594
+ l = !0;
595
+ else
596
+ return a.currentValue;
597
+ a.currentValue.decompose(i, n, e);
598
+ }
599
+ if (!l) {
600
+ i.scaleInPlace(o), e.scaleInPlace(o), n.scaleInPlace(o);
601
+ for (let c = s; c < h.animations.length; c++) {
602
+ const g = h.animations[c];
603
+ if (g.weight === 0)
604
+ continue;
605
+ o = g.weight / t;
606
+ const d = T.Vector3[2], _ = T.Vector3[3], m = T.Quaternion[1];
607
+ g.currentValue.decompose(_, m, d), _.scaleAndAddToRef(o, i), m.scaleAndAddToRef(S.Dot(n, m) > 0 ? o : -o, n), d.scaleAndAddToRef(o, e);
608
+ }
609
+ n.normalize();
610
+ }
611
+ for (let c = 0; c < h.additiveAnimations.length; c++) {
612
+ const g = h.additiveAnimations[c];
613
+ if (g.weight === 0)
614
+ continue;
615
+ const d = T.Vector3[2], _ = T.Vector3[3], m = T.Quaternion[1];
616
+ g.currentValue.decompose(_, m, d), _.multiplyToRef(i, _), k.LerpToRef(i, _, g.weight, i), n.multiplyToRef(m, m), S.SlerpToRef(n, m, g.weight, n), d.scaleAndAddToRef(g.weight, e);
617
+ }
618
+ const u = a ? a._animationState.workValue : T.Matrix[0].clone();
619
+ return F.ComposeToRef(i, n, e, u), u;
620
+ }
621
+ function H(h, t) {
622
+ if (h.totalWeight === 0 && h.totalAdditiveWeight === 0)
623
+ return t;
624
+ const e = h.animations[0], i = h.originalValue;
625
+ let n = t;
626
+ if (h.totalWeight === 0 && h.totalAdditiveWeight > 0)
627
+ n.copyFrom(i);
628
+ else if (h.animations.length === 1) {
629
+ if (S.SlerpToRef(i, e.currentValue, Math.min(1, h.totalWeight), n), h.totalAdditiveWeight === 0)
630
+ return n;
631
+ } else if (h.animations.length > 1) {
632
+ let s = 1, a, r;
633
+ if (h.totalWeight < 1) {
634
+ const l = 1 - h.totalWeight;
635
+ a = [], r = [], a.push(i), r.push(l);
636
+ } else {
637
+ if (h.animations.length === 2 && (S.SlerpToRef(h.animations[0].currentValue, h.animations[1].currentValue, h.animations[1].weight / h.totalWeight, t), h.totalAdditiveWeight === 0))
638
+ return t;
639
+ a = [], r = [], s = h.totalWeight;
640
+ }
641
+ for (let l = 0; l < h.animations.length; l++) {
642
+ const u = h.animations[l];
643
+ a.push(u.currentValue), r.push(u.weight / s);
644
+ }
645
+ let o = 0;
646
+ for (let l = 0; l < a.length; ) {
647
+ if (!l) {
648
+ S.SlerpToRef(a[l], a[l + 1], r[l + 1] / (r[l] + r[l + 1]), t), n = t, o = r[l] + r[l + 1], l += 2;
649
+ continue;
650
+ }
651
+ o += r[l], S.SlerpToRef(n, a[l], r[l] / o, n), l++;
652
+ }
653
+ }
654
+ for (let s = 0; s < h.additiveAnimations.length; s++) {
655
+ const a = h.additiveAnimations[s];
656
+ a.weight !== 0 && (n.multiplyToRef(a.currentValue, T.Quaternion[0]), S.SlerpToRef(n, T.Quaternion[0], a.weight, n));
657
+ }
658
+ return n;
659
+ }
660
+ function J(h) {
661
+ if (h._registeredForLateAnimationBindings.length) {
662
+ for (let t = 0; t < h._registeredForLateAnimationBindings.length; t++) {
663
+ const e = h._registeredForLateAnimationBindings.data[t];
664
+ for (const i in e._lateAnimationHolders) {
665
+ const n = e._lateAnimationHolders[i], s = n.animations[0], a = n.originalValue;
666
+ if (a == null)
667
+ continue;
668
+ const r = A.AllowMatrixDecomposeForInterpolation && a.m;
669
+ let o = e[i];
670
+ if (r)
671
+ o = z(n);
672
+ else if (a.w !== void 0)
673
+ o = H(n, o || S.Identity());
674
+ else {
675
+ let u = 0, c = 1;
676
+ const g = s && s._animationState.loopMode === A.ANIMATIONLOOPMODE_RELATIVE_FROM_CURRENT;
677
+ if (n.totalWeight < 1)
678
+ g ? o = a.clone ? a.clone() : a : s && a.scale ? o = a.scale(1 - n.totalWeight) : s ? o = a * (1 - n.totalWeight) : a.clone ? o = a.clone() : o = a;
679
+ else if (s) {
680
+ c = n.totalWeight;
681
+ const d = s.weight / c;
682
+ d !== 1 ? s.currentValue.scale ? o = s.currentValue.scale(d) : o = s.currentValue * d : o = s.currentValue, g && (o.addToRef ? o.addToRef(a, o) : o += a), u = 1;
683
+ }
684
+ for (let d = u; d < n.animations.length; d++) {
685
+ const _ = n.animations[d], m = _.weight / c;
686
+ if (m)
687
+ _.currentValue.scaleAndAddToRef ? _.currentValue.scaleAndAddToRef(m, o) : o += _.currentValue * m;
688
+ else continue;
689
+ }
690
+ for (let d = 0; d < n.additiveAnimations.length; d++) {
691
+ const _ = n.additiveAnimations[d], m = _.weight;
692
+ if (m)
693
+ _.currentValue.scaleAndAddToRef ? _.currentValue.scaleAndAddToRef(m, o) : o += _.currentValue * m;
694
+ else continue;
695
+ }
696
+ }
697
+ e[i] = o;
698
+ }
699
+ e._lateAnimationHolders = {};
700
+ }
701
+ h._registeredForLateAnimationBindings.reset();
702
+ }
703
+ }
704
+ function X(h, t) {
705
+ t && (t.prototype.copyAnimationRange = function(e, i, n, s = !1, a = null) {
706
+ this.animations.length === 0 && (this.animations.push(new A(this.name, "_matrix", e.animations[0].framePerSecond, A.ANIMATIONTYPE_MATRIX, 0)), this.animations[0].setKeys([]));
707
+ const r = e.animations[0].getRange(i);
708
+ if (!r)
709
+ return !1;
710
+ const o = r.from, l = r.to, u = e.animations[0].getKeys(), c = e.length, g = e.getParent(), d = this.getParent(), _ = s && g && c && this.length && c !== this.length, m = _ && d && g ? d.length / g.length : 1, b = s && !d && a && (a.x !== 1 || a.y !== 1 || a.z !== 1), O = this.animations[0].getKeys();
711
+ let v, f, p;
712
+ for (let y = 0, L = u.length; y < L; y++)
713
+ v = u[y], v.frame >= o && v.frame <= l && (s ? (p = v.value.clone(), _ ? (f = p.getTranslation(), p.setTranslation(f.scaleInPlace(m))) : b && a ? (f = p.getTranslation(), p.setTranslation(f.multiplyInPlace(a))) : p = v.value) : p = v.value, O.push({ frame: v.frame + n, value: p }));
714
+ return this.animations[0].createRange(i, o + n, l + n), !0;
715
+ }), h && (h.prototype._animate = function(e) {
716
+ if (!this.animationsEnabled)
717
+ return;
718
+ const i = C.Now;
719
+ if (!this._animationTimeLast) {
720
+ if (this._pendingData.length > 0)
721
+ return;
722
+ this._animationTimeLast = i;
723
+ }
724
+ this.deltaTime = e !== void 0 ? e : this.useConstantAnimationDeltaTime ? 16 : (i - this._animationTimeLast) * this.animationTimeScale, this._animationTimeLast = i;
725
+ const n = this._activeAnimatables;
726
+ if (n.length === 0)
727
+ return;
728
+ this._animationTime += this.deltaTime;
729
+ const s = this._animationTime;
730
+ for (let a = 0; a < n.length; a++) {
731
+ const r = n[a];
732
+ !r._animate(s) && r.disposeOnEnd && a--;
733
+ }
734
+ J(this);
735
+ }, h.prototype.sortActiveAnimatables = function() {
736
+ this._activeAnimatables.sort((e, i) => e.playOrder - i.playOrder);
737
+ }, h.prototype.beginWeightedAnimation = function(e, i, n, s = 1, a, r = 1, o, l, u, c, g = !1) {
738
+ const d = this.beginAnimation(e, i, n, a, r, o, l, !1, u, c, g);
739
+ return d.weight = s, d;
740
+ }, h.prototype.beginAnimation = function(e, i, n, s, a = 1, r, o, l = !0, u, c, g = !1) {
741
+ if (a < 0) {
742
+ const _ = i;
743
+ i = n, n = _, a = -a;
744
+ }
745
+ i > n && (a = -a), l && this.stopAnimation(e, void 0, u), o || (o = new I(this, e, i, n, s, a, r, void 0, c, g));
746
+ const d = u ? u(e) : !0;
747
+ if (e.animations && d && o.appendAnimations(e, e.animations), e.getAnimatables) {
748
+ const _ = e.getAnimatables();
749
+ for (let m = 0; m < _.length; m++)
750
+ this.beginAnimation(_[m], i, n, s, a, r, o, l, u, c);
751
+ }
752
+ return o.reset(), o;
753
+ }, h.prototype.beginHierarchyAnimation = function(e, i, n, s, a, r = 1, o, l, u = !0, c, g, d = !1) {
754
+ const _ = e.getDescendants(i), m = [];
755
+ m.push(this.beginAnimation(e, n, s, a, r, o, l, u, c, void 0, d));
756
+ for (const b of _)
757
+ m.push(this.beginAnimation(b, n, s, a, r, o, l, u, c, void 0, d));
758
+ return m;
759
+ }, h.prototype.beginDirectAnimation = function(e, i, n, s, a, r = 1, o, l, u = !1) {
760
+ if (r < 0) {
761
+ const g = n;
762
+ n = s, s = g, r = -r;
763
+ }
764
+ return n > s && (r = -r), new I(this, e, n, s, a, r, o, i, l, u);
765
+ }, h.prototype.beginDirectHierarchyAnimation = function(e, i, n, s, a, r, o, l, u, c = !1) {
766
+ const g = e.getDescendants(i), d = [];
767
+ d.push(this.beginDirectAnimation(e, n, s, a, r, o, l, u, c));
768
+ for (const _ of g)
769
+ d.push(this.beginDirectAnimation(_, n, s, a, r, o, l, u, c));
770
+ return d;
771
+ }, h.prototype.getAnimatableByTarget = function(e) {
772
+ for (let i = 0; i < this._activeAnimatables.length; i++)
773
+ if (this._activeAnimatables[i].target === e)
774
+ return this._activeAnimatables[i];
775
+ return null;
776
+ }, h.prototype.getAllAnimatablesByTarget = function(e) {
777
+ const i = [];
778
+ for (let n = 0; n < this._activeAnimatables.length; n++)
779
+ this._activeAnimatables[n].target === e && i.push(this._activeAnimatables[n]);
780
+ return i;
781
+ }, h.prototype.stopAnimation = function(e, i, n) {
782
+ const s = this.getAllAnimatablesByTarget(e);
783
+ for (const a of s)
784
+ a.stop(i, n);
785
+ }, h.prototype.stopAllAnimations = function() {
786
+ if (this._activeAnimatables) {
787
+ for (let e = 0; e < this._activeAnimatables.length; e++)
788
+ this._activeAnimatables[e].stop(void 0, void 0, !0);
789
+ this._activeAnimatables.length = 0;
790
+ }
791
+ for (const e of this.animationGroups)
792
+ e.stop();
793
+ });
794
+ }
795
+ X(W, D);
796
+ class q {
797
+ /**
798
+ * Returns the string "TargetedAnimation"
799
+ * @returns "TargetedAnimation"
800
+ */
801
+ getClassName() {
802
+ return "TargetedAnimation";
803
+ }
804
+ /**
805
+ * Creates a new targeted animation
806
+ * @param parent The animation group to which the animation belongs
807
+ */
808
+ constructor(t) {
809
+ this.parent = t, this.uniqueId = U.UniqueId;
810
+ }
811
+ /**
812
+ * Serialize the object
813
+ * @returns the JSON object representing the current entity
814
+ */
815
+ serialize() {
816
+ const t = {};
817
+ return t.animation = this.animation.serialize(), t.targetId = this.target.id, t.targetUniqueId = this.target.uniqueId, t;
818
+ }
819
+ }
820
+ class V {
821
+ /**
822
+ * Gets or sets the mask associated with this animation group. This mask is used to filter which objects should be animated.
823
+ */
824
+ get mask() {
825
+ return this._mask;
826
+ }
827
+ set mask(t) {
828
+ this._mask !== t && (this._mask = t, this.syncWithMask(!0));
829
+ }
830
+ /**
831
+ * Makes sure that the animations are either played or stopped according to the animation group mask.
832
+ * Note however that the call won't have any effect if the animation group has not been started yet.
833
+ * @param forceUpdate If true, forces to loop over the animatables even if no mask is defined (used internally, you shouldn't need to use it). Default: false.
834
+ */
835
+ syncWithMask(t = !1) {
836
+ if (!this.mask && !t) {
837
+ this._numActiveAnimatables = this._targetedAnimations.length;
838
+ return;
839
+ }
840
+ this._numActiveAnimatables = 0;
841
+ for (let e = 0; e < this._animatables.length; ++e) {
842
+ const i = this._animatables[e];
843
+ !this.mask || this.mask.disabled || this.mask.retainsTarget(i.target.name) ? (this._numActiveAnimatables++, i.paused && i.restart()) : i.paused || i.pause();
844
+ }
845
+ }
846
+ /**
847
+ * Removes all animations for the targets not retained by the animation group mask.
848
+ * Use this function if you know you won't need those animations anymore and if you want to free memory.
849
+ */
850
+ removeUnmaskedAnimations() {
851
+ if (!(!this.mask || this.mask.disabled)) {
852
+ for (let t = 0; t < this._animatables.length; ++t) {
853
+ const e = this._animatables[t];
854
+ this.mask.retainsTarget(e.target.name) || (e.stop(), this._animatables.splice(t, 1), --t);
855
+ }
856
+ for (let t = 0; t < this._targetedAnimations.length; t++) {
857
+ const e = this._targetedAnimations[t];
858
+ this.mask.retainsTarget(e.target.name) || (this._targetedAnimations.splice(t, 1), --t);
859
+ }
860
+ }
861
+ }
862
+ /**
863
+ * Gets or sets the first frame
864
+ */
865
+ get from() {
866
+ return this._from;
867
+ }
868
+ set from(t) {
869
+ if (this._from !== t) {
870
+ this._from = t;
871
+ for (let e = 0; e < this._animatables.length; e++) {
872
+ const i = this._animatables[e];
873
+ i.fromFrame = this._from;
874
+ }
875
+ }
876
+ }
877
+ /**
878
+ * Gets or sets the last frame
879
+ */
880
+ get to() {
881
+ return this._to;
882
+ }
883
+ set to(t) {
884
+ if (this._to !== t) {
885
+ this._to = t;
886
+ for (let e = 0; e < this._animatables.length; e++) {
887
+ const i = this._animatables[e];
888
+ i.toFrame = this._to;
889
+ }
890
+ }
891
+ }
892
+ /**
893
+ * Define if the animations are started
894
+ */
895
+ get isStarted() {
896
+ return this._isStarted;
897
+ }
898
+ /**
899
+ * Gets a value indicating that the current group is playing
900
+ */
901
+ get isPlaying() {
902
+ return this._isStarted && !this._isPaused;
903
+ }
904
+ /**
905
+ * Gets or sets the speed ratio to use for all animations
906
+ */
907
+ get speedRatio() {
908
+ return this._speedRatio;
909
+ }
910
+ /**
911
+ * Gets or sets the speed ratio to use for all animations
912
+ */
913
+ set speedRatio(t) {
914
+ if (this._speedRatio !== t) {
915
+ this._speedRatio = t;
916
+ for (let e = 0; e < this._animatables.length; e++) {
917
+ const i = this._animatables[e];
918
+ i.speedRatio = this._speedRatio;
919
+ }
920
+ }
921
+ }
922
+ /**
923
+ * Gets or sets if all animations should loop or not
924
+ */
925
+ get loopAnimation() {
926
+ return this._loopAnimation;
927
+ }
928
+ set loopAnimation(t) {
929
+ if (this._loopAnimation !== t) {
930
+ this._loopAnimation = t;
931
+ for (let e = 0; e < this._animatables.length; e++) {
932
+ const i = this._animatables[e];
933
+ i.loopAnimation = this._loopAnimation;
934
+ }
935
+ }
936
+ }
937
+ /**
938
+ * Gets or sets if all animations should be evaluated additively
939
+ */
940
+ get isAdditive() {
941
+ return this._isAdditive;
942
+ }
943
+ set isAdditive(t) {
944
+ if (this._isAdditive !== t) {
945
+ this._isAdditive = t;
946
+ for (let e = 0; e < this._animatables.length; e++) {
947
+ const i = this._animatables[e];
948
+ i.isAdditive = this._isAdditive;
949
+ }
950
+ }
951
+ }
952
+ /**
953
+ * Gets or sets the weight to apply to all animations of the group
954
+ */
955
+ get weight() {
956
+ return this._weight;
957
+ }
958
+ set weight(t) {
959
+ this._weight !== t && (this._weight = t, this.setWeightForAllAnimatables(this._weight));
960
+ }
961
+ /**
962
+ * Gets the targeted animations for this animation group
963
+ */
964
+ get targetedAnimations() {
965
+ return this._targetedAnimations;
966
+ }
967
+ /**
968
+ * returning the list of animatables controlled by this animation group.
969
+ */
970
+ get animatables() {
971
+ return this._animatables;
972
+ }
973
+ /**
974
+ * Gets the list of target animations
975
+ */
976
+ get children() {
977
+ return this._targetedAnimations;
978
+ }
979
+ /**
980
+ * Gets or sets the order of play of the animation group (default: 0)
981
+ */
982
+ get playOrder() {
983
+ return this._playOrder;
984
+ }
985
+ set playOrder(t) {
986
+ if (this._playOrder !== t && (this._playOrder = t, this._animatables.length > 0)) {
987
+ for (let e = 0; e < this._animatables.length; e++)
988
+ this._animatables[e].playOrder = this._playOrder;
989
+ this._scene.sortActiveAnimatables();
990
+ }
991
+ }
992
+ /**
993
+ * Allows the animations of the animation group to blend with current running animations
994
+ * Note that a null value means that each animation will use their own existing blending configuration (Animation.enableBlending)
995
+ */
996
+ get enableBlending() {
997
+ return this._enableBlending;
998
+ }
999
+ set enableBlending(t) {
1000
+ if (this._enableBlending !== t && (this._enableBlending = t, t !== null))
1001
+ for (let e = 0; e < this._targetedAnimations.length; ++e)
1002
+ this._targetedAnimations[e].animation.enableBlending = t;
1003
+ }
1004
+ /**
1005
+ * Gets or sets the animation blending speed
1006
+ * Note that a null value means that each animation will use their own existing blending configuration (Animation.blendingSpeed)
1007
+ */
1008
+ get blendingSpeed() {
1009
+ return this._blendingSpeed;
1010
+ }
1011
+ set blendingSpeed(t) {
1012
+ if (this._blendingSpeed !== t && (this._blendingSpeed = t, t !== null))
1013
+ for (let e = 0; e < this._targetedAnimations.length; ++e)
1014
+ this._targetedAnimations[e].animation.blendingSpeed = t;
1015
+ }
1016
+ /**
1017
+ * Gets the length (in seconds) of the animation group
1018
+ * This function assumes that all animations are played at the same framePerSecond speed!
1019
+ * Note: you can only call this method after you've added at least one targeted animation!
1020
+ * @param from Starting frame range (default is AnimationGroup.from)
1021
+ * @param to Ending frame range (default is AnimationGroup.to)
1022
+ * @returns The length in seconds
1023
+ */
1024
+ getLength(t, e) {
1025
+ t = t ?? this._from, e = e ?? this._to;
1026
+ const i = this.targetedAnimations[0].animation.framePerSecond * this._speedRatio;
1027
+ return (e - t) / i;
1028
+ }
1029
+ /**
1030
+ * Merge the array of animation groups into a new animation group
1031
+ * @param animationGroups List of animation groups to merge
1032
+ * @param disposeSource If true, animation groups will be disposed after being merged (default: true)
1033
+ * @param normalize If true, animation groups will be normalized before being merged, so that all animations have the same "from" and "to" frame (default: false)
1034
+ * @param weight Weight for the new animation group. If not provided, it will inherit the weight from the first animation group of the array
1035
+ * @returns The new animation group or null if no animation groups were passed
1036
+ */
1037
+ static MergeAnimationGroups(t, e = !0, i = !1, n) {
1038
+ if (t.length === 0)
1039
+ return null;
1040
+ n = n ?? t[0].weight;
1041
+ let s = Number.MAX_VALUE, a = -Number.MAX_VALUE;
1042
+ if (i)
1043
+ for (const o of t)
1044
+ o.from < s && (s = o.from), o.to > a && (a = o.to);
1045
+ const r = new V(t[0].name + "_merged", t[0]._scene, n);
1046
+ for (const o of t) {
1047
+ i && o.normalize(s, a);
1048
+ for (const l of o.targetedAnimations)
1049
+ r.addTargetedAnimation(l.animation, l.target);
1050
+ e && o.dispose();
1051
+ }
1052
+ return r;
1053
+ }
1054
+ /**
1055
+ * Gets the scene the animation group belongs to
1056
+ * @returns The scene the animation group belongs to
1057
+ */
1058
+ getScene() {
1059
+ return this._scene;
1060
+ }
1061
+ /**
1062
+ * Instantiates a new Animation Group.
1063
+ * This helps managing several animations at once.
1064
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/groupAnimations
1065
+ * @param name Defines the name of the group
1066
+ * @param scene Defines the scene the group belongs to
1067
+ * @param weight Defines the weight to use for animations in the group (-1.0 by default, meaning "no weight")
1068
+ * @param playOrder Defines the order of play of the animation group (default is 0)
1069
+ */
1070
+ constructor(t, e = null, i = -1, n = 0) {
1071
+ this.name = t, this._targetedAnimations = new Array(), this._animatables = new Array(), this._from = Number.MAX_VALUE, this._to = -Number.MAX_VALUE, this._speedRatio = 1, this._loopAnimation = !1, this._isAdditive = !1, this._weight = -1, this._playOrder = 0, this._enableBlending = null, this._blendingSpeed = null, this._numActiveAnimatables = 0, this._shouldStart = !0, this._parentContainer = null, this.onAnimationEndObservable = new P(), this.onAnimationLoopObservable = new P(), this.onAnimationGroupLoopObservable = new P(), this.onAnimationGroupEndObservable = new P(), this.onAnimationGroupPauseObservable = new P(), this.onAnimationGroupPlayObservable = new P(), this.metadata = null, this._mask = null, this._animationLoopFlags = [], this._scene = e || K.LastCreatedScene, this._weight = i, this._playOrder = n, this.uniqueId = this._scene.getUniqueId(), this._scene.addAnimationGroup(this);
1072
+ }
1073
+ /**
1074
+ * Add an animation (with its target) in the group
1075
+ * @param animation defines the animation we want to add
1076
+ * @param target defines the target of the animation
1077
+ * @returns the TargetedAnimation object
1078
+ */
1079
+ addTargetedAnimation(t, e) {
1080
+ const i = new q(this);
1081
+ i.animation = t, i.target = e;
1082
+ const n = t.getKeys();
1083
+ return this._from > n[0].frame && (this._from = n[0].frame), this._to < n[n.length - 1].frame && (this._to = n[n.length - 1].frame), this._enableBlending !== null && (t.enableBlending = this._enableBlending), this._blendingSpeed !== null && (t.blendingSpeed = this._blendingSpeed), this._targetedAnimations.push(i), this._shouldStart = !0, i;
1084
+ }
1085
+ /**
1086
+ * Remove an animation from the group
1087
+ * @param animation defines the animation we want to remove
1088
+ */
1089
+ removeTargetedAnimation(t) {
1090
+ for (let e = this._targetedAnimations.length - 1; e > -1; e--)
1091
+ this._targetedAnimations[e].animation === t && this._targetedAnimations.splice(e, 1);
1092
+ }
1093
+ /**
1094
+ * This function will normalize every animation in the group to make sure they all go from beginFrame to endFrame
1095
+ * It can add constant keys at begin or end
1096
+ * @param beginFrame defines the new begin frame for all animations or the smallest begin frame of all animations if null (defaults to null)
1097
+ * @param endFrame defines the new end frame for all animations or the largest end frame of all animations if null (defaults to null)
1098
+ * @returns the animation group
1099
+ */
1100
+ normalize(t = null, e = null) {
1101
+ t == null && (t = this._from), e == null && (e = this._to);
1102
+ for (let i = 0; i < this._targetedAnimations.length; i++) {
1103
+ const s = this._targetedAnimations[i].animation.getKeys(), a = s[0], r = s[s.length - 1];
1104
+ if (a.frame > t) {
1105
+ const o = {
1106
+ frame: t,
1107
+ value: a.value,
1108
+ inTangent: a.inTangent,
1109
+ outTangent: a.outTangent,
1110
+ interpolation: a.interpolation
1111
+ };
1112
+ s.splice(0, 0, o);
1113
+ }
1114
+ if (r.frame < e) {
1115
+ const o = {
1116
+ frame: e,
1117
+ value: r.value,
1118
+ inTangent: r.inTangent,
1119
+ outTangent: r.outTangent,
1120
+ interpolation: r.interpolation
1121
+ };
1122
+ s.push(o);
1123
+ }
1124
+ }
1125
+ return this._from = t, this._to = e, this;
1126
+ }
1127
+ _processLoop(t, e, i) {
1128
+ t.onAnimationLoop = () => {
1129
+ this.onAnimationLoopObservable.notifyObservers(e), !this._animationLoopFlags[i] && (this._animationLoopFlags[i] = !0, this._animationLoopCount++, this._animationLoopCount === this._numActiveAnimatables && (this.onAnimationGroupLoopObservable.notifyObservers(this), this._animationLoopCount = 0, this._animationLoopFlags.length = 0));
1130
+ };
1131
+ }
1132
+ /**
1133
+ * Start all animations on given targets
1134
+ * @param loop defines if animations must loop
1135
+ * @param speedRatio defines the ratio to apply to animation speed (1 by default)
1136
+ * @param from defines the from key (optional)
1137
+ * @param to defines the to key (optional)
1138
+ * @param isAdditive defines the additive state for the resulting animatables (optional)
1139
+ * @returns the current animation group
1140
+ */
1141
+ start(t = !1, e = 1, i, n, s) {
1142
+ if (this._isStarted || this._targetedAnimations.length === 0)
1143
+ return this;
1144
+ this._loopAnimation = t, this._shouldStart = !1, this._animationLoopCount = 0, this._animationLoopFlags.length = 0;
1145
+ for (let a = 0; a < this._targetedAnimations.length; a++) {
1146
+ const r = this._targetedAnimations[a], o = this._scene.beginDirectAnimation(r.target, [r.animation], i !== void 0 ? i : this._from, n !== void 0 ? n : this._to, t, e, void 0, void 0, s !== void 0 ? s : this._isAdditive);
1147
+ o.weight = this._weight, o.playOrder = this._playOrder, o.onAnimationEnd = () => {
1148
+ this.onAnimationEndObservable.notifyObservers(r), this._checkAnimationGroupEnded(o);
1149
+ }, this._processLoop(o, r, a), this._animatables.push(o);
1150
+ }
1151
+ return this.syncWithMask(), this._scene.sortActiveAnimatables(), this._speedRatio = e, this._isStarted = !0, this._isPaused = !1, this.onAnimationGroupPlayObservable.notifyObservers(this), this;
1152
+ }
1153
+ /**
1154
+ * Pause all animations
1155
+ * @returns the animation group
1156
+ */
1157
+ pause() {
1158
+ if (!this._isStarted)
1159
+ return this;
1160
+ this._isPaused = !0;
1161
+ for (let t = 0; t < this._animatables.length; t++)
1162
+ this._animatables[t].pause();
1163
+ return this.onAnimationGroupPauseObservable.notifyObservers(this), this;
1164
+ }
1165
+ /**
1166
+ * Play all animations to initial state
1167
+ * This function will start() the animations if they were not started or will restart() them if they were paused
1168
+ * @param loop defines if animations must loop
1169
+ * @returns the animation group
1170
+ */
1171
+ play(t) {
1172
+ return this.isStarted && this._animatables.length && !this._shouldStart ? (t !== void 0 && (this.loopAnimation = t), this.restart()) : (this.stop(), this.start(t, this._speedRatio)), this;
1173
+ }
1174
+ /**
1175
+ * Reset all animations to initial state
1176
+ * @returns the animation group
1177
+ */
1178
+ reset() {
1179
+ if (!this._isStarted)
1180
+ return this.play(), this.goToFrame(0), this.stop(!0), this;
1181
+ for (let t = 0; t < this._animatables.length; t++)
1182
+ this._animatables[t].reset();
1183
+ return this;
1184
+ }
1185
+ /**
1186
+ * Restart animations from after pausing it
1187
+ * @returns the animation group
1188
+ */
1189
+ restart() {
1190
+ if (!this._isStarted)
1191
+ return this;
1192
+ for (let t = 0; t < this._animatables.length; t++)
1193
+ this._animatables[t].restart();
1194
+ return this.syncWithMask(), this._isPaused = !1, this.onAnimationGroupPlayObservable.notifyObservers(this), this;
1195
+ }
1196
+ /**
1197
+ * Stop all animations
1198
+ * @param skipOnAnimationEnd defines if the system should not raise onAnimationEnd. Default is false
1199
+ * @returns the animation group
1200
+ */
1201
+ stop(t = !1) {
1202
+ if (!this._isStarted)
1203
+ return this;
1204
+ const e = this._animatables.slice();
1205
+ for (let n = 0; n < e.length; n++)
1206
+ e[n].stop(void 0, void 0, !0, t);
1207
+ let i = 0;
1208
+ for (let n = 0; n < this._scene._activeAnimatables.length; n++) {
1209
+ const s = this._scene._activeAnimatables[n];
1210
+ s._runtimeAnimations.length > 0 ? this._scene._activeAnimatables[i++] = s : t && this._checkAnimationGroupEnded(s, t);
1211
+ }
1212
+ return this._scene._activeAnimatables.length = i, this._isStarted = !1, this;
1213
+ }
1214
+ /**
1215
+ * Set animation weight for all animatables
1216
+ *
1217
+ * @since 6.12.4
1218
+ * You can pass the weight to the AnimationGroup constructor, or use the weight property to set it after the group has been created,
1219
+ * making it easier to define the overall animation weight than calling setWeightForAllAnimatables() after the animation group has been started
1220
+ * @param weight defines the weight to use
1221
+ * @returns the animationGroup
1222
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#animation-weights
1223
+ */
1224
+ setWeightForAllAnimatables(t) {
1225
+ for (let e = 0; e < this._animatables.length; e++) {
1226
+ const i = this._animatables[e];
1227
+ i.weight = t;
1228
+ }
1229
+ return this;
1230
+ }
1231
+ /**
1232
+ * Synchronize and normalize all animatables with a source animatable
1233
+ * @param root defines the root animatable to synchronize with (null to stop synchronizing)
1234
+ * @returns the animationGroup
1235
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#animation-weights
1236
+ */
1237
+ syncAllAnimationsWith(t) {
1238
+ for (let e = 0; e < this._animatables.length; e++)
1239
+ this._animatables[e].syncWith(t);
1240
+ return this;
1241
+ }
1242
+ /**
1243
+ * Goes to a specific frame in this animation group. Note that the animation group must be in playing or paused status
1244
+ * @param frame the frame number to go to
1245
+ * @param useWeight defines whether the animation weight should be applied to the image to be jumped to (false by default)
1246
+ * @returns the animationGroup
1247
+ */
1248
+ goToFrame(t, e = !1) {
1249
+ if (!this._isStarted)
1250
+ return this;
1251
+ for (let i = 0; i < this._animatables.length; i++)
1252
+ this._animatables[i].goToFrame(t, e);
1253
+ return this;
1254
+ }
1255
+ /**
1256
+ * Helper to get the current frame. This will return 0 if the AnimationGroup is not running, and it might return wrong results if multiple animations are running in different frames.
1257
+ * @returns current animation frame.
1258
+ */
1259
+ getCurrentFrame() {
1260
+ return this.animatables[0]?.masterFrame || 0;
1261
+ }
1262
+ /**
1263
+ * Dispose all associated resources
1264
+ */
1265
+ dispose() {
1266
+ if (this.isStarted && this.stop(), this._targetedAnimations.length = 0, this._animatables.length = 0, this._scene.removeAnimationGroup(this), this._parentContainer) {
1267
+ const t = this._parentContainer.animationGroups.indexOf(this);
1268
+ t > -1 && this._parentContainer.animationGroups.splice(t, 1), this._parentContainer = null;
1269
+ }
1270
+ this.onAnimationEndObservable.clear(), this.onAnimationGroupEndObservable.clear(), this.onAnimationGroupPauseObservable.clear(), this.onAnimationGroupPlayObservable.clear(), this.onAnimationLoopObservable.clear(), this.onAnimationGroupLoopObservable.clear();
1271
+ }
1272
+ _checkAnimationGroupEnded(t, e = !1) {
1273
+ const i = this._animatables.indexOf(t);
1274
+ i > -1 && this._animatables.splice(i, 1), this._animatables.length === this._targetedAnimations.length - this._numActiveAnimatables && (this._isStarted = !1, e || this.onAnimationGroupEndObservable.notifyObservers(this), this._animatables.length = 0);
1275
+ }
1276
+ /**
1277
+ * Clone the current animation group and returns a copy
1278
+ * @param newName defines the name of the new group
1279
+ * @param targetConverter defines an optional function used to convert current animation targets to new ones
1280
+ * @param cloneAnimations defines if the animations should be cloned or referenced
1281
+ * @param cloneAnimationKeys defines if the animation keys should be cloned when cloning animations (false by default). No effect if cloneAnimations is false
1282
+ * @returns the new animation group
1283
+ */
1284
+ clone(t, e, i = !1, n = !1) {
1285
+ const s = new V(t || this.name, this._scene, this._weight, this._playOrder);
1286
+ s._from = this.from, s._to = this.to, s._speedRatio = this.speedRatio, s._loopAnimation = this.loopAnimation, s._isAdditive = this.isAdditive, s._enableBlending = this.enableBlending, s._blendingSpeed = this.blendingSpeed, s.metadata = this.metadata, s.mask = this.mask;
1287
+ for (const a of this._targetedAnimations)
1288
+ s.addTargetedAnimation(i ? a.animation.clone(n) : a.animation, e ? e(a.target) : a.target);
1289
+ return s;
1290
+ }
1291
+ /**
1292
+ * Serializes the animationGroup to an object
1293
+ * @returns Serialized object
1294
+ */
1295
+ serialize() {
1296
+ const t = {};
1297
+ t.name = this.name, t.from = this.from, t.to = this.to, t.speedRatio = this.speedRatio, t.loopAnimation = this.loopAnimation, t.isAdditive = this.isAdditive, t.weight = this.weight, t.playOrder = this.playOrder, t.enableBlending = this.enableBlending, t.blendingSpeed = this.blendingSpeed, t.targetedAnimations = [];
1298
+ for (let e = 0; e < this.targetedAnimations.length; e++) {
1299
+ const i = this.targetedAnimations[e];
1300
+ t.targetedAnimations[e] = i.serialize();
1301
+ }
1302
+ return w && w.HasTags(this) && (t.tags = w.GetTags(this)), this.metadata && (t.metadata = this.metadata), t;
1303
+ }
1304
+ // Statics
1305
+ /**
1306
+ * Returns a new AnimationGroup object parsed from the source provided.
1307
+ * @param parsedAnimationGroup defines the source
1308
+ * @param scene defines the scene that will receive the animationGroup
1309
+ * @param targetLookup a callback that will be used instead of the default lookup
1310
+ * @returns a new AnimationGroup
1311
+ */
1312
+ static Parse(t, e, i) {
1313
+ const n = new V(t.name, e, t.weight, t.playOrder);
1314
+ for (let s = 0; s < t.targetedAnimations.length; s++) {
1315
+ const a = t.targetedAnimations[s], r = A.Parse(a.animation), o = i ? i(a) : a.animation.property === "influence" ? e.getMorphTargetById(a.targetId) : e.getNodeById(a.targetId);
1316
+ o && n.addTargetedAnimation(r, o);
1317
+ }
1318
+ return w && w.AddTagsTo(n, t.tags), t.from !== null && t.to !== null && n.normalize(t.from, t.to), t.speedRatio !== void 0 && (n._speedRatio = t.speedRatio), t.loopAnimation !== void 0 && (n._loopAnimation = t.loopAnimation), t.isAdditive !== void 0 && (n._isAdditive = t.isAdditive), t.weight !== void 0 && (n._weight = t.weight), t.playOrder !== void 0 && (n._playOrder = t.playOrder), t.enableBlending !== void 0 && (n._enableBlending = t.enableBlending), t.blendingSpeed !== void 0 && (n._blendingSpeed = t.blendingSpeed), t.metadata !== void 0 && (n.metadata = t.metadata), n;
1319
+ }
1320
+ /** @internal */
1321
+ static MakeAnimationAdditive(t, e, i, n = !1, s) {
1322
+ let a;
1323
+ typeof e == "object" ? a = e : a = {
1324
+ referenceFrame: e,
1325
+ range: i,
1326
+ cloneOriginalAnimationGroup: n,
1327
+ clonedAnimationName: s
1328
+ };
1329
+ let r = t;
1330
+ a.cloneOriginalAnimationGroup && (r = t.clone(a.clonedAnimationGroupName || r.name));
1331
+ const o = r.targetedAnimations;
1332
+ for (let l = 0; l < o.length; l++) {
1333
+ const u = o[l];
1334
+ u.animation = A.MakeAnimationAdditive(u.animation, a);
1335
+ }
1336
+ if (r.isAdditive = !0, a.clipKeys) {
1337
+ let l = Number.MAX_VALUE, u = -Number.MAX_VALUE;
1338
+ const c = r.targetedAnimations;
1339
+ for (let g = 0; g < c.length; g++) {
1340
+ const m = c[g].animation.getKeys();
1341
+ l > m[0].frame && (l = m[0].frame), u < m[m.length - 1].frame && (u = m[m.length - 1].frame);
1342
+ }
1343
+ r._from = l, r._to = u;
1344
+ }
1345
+ return r;
1346
+ }
1347
+ /**
1348
+ * Creates a new animation, keeping only the keys that are inside a given key range
1349
+ * @param sourceAnimationGroup defines the animation group on which to operate
1350
+ * @param fromKey defines the lower bound of the range
1351
+ * @param toKey defines the upper bound of the range
1352
+ * @param name defines the name of the new animation group. If not provided, use the same name as animationGroup
1353
+ * @param dontCloneAnimations defines whether or not the animations should be cloned before clipping the keys. Default is false, so animations will be cloned
1354
+ * @returns a new animation group stripped from all the keys outside the given range
1355
+ */
1356
+ static ClipKeys(t, e, i, n, s) {
1357
+ const a = t.clone(n || t.name);
1358
+ return V.ClipKeysInPlace(a, e, i, s);
1359
+ }
1360
+ /**
1361
+ * Updates an existing animation, keeping only the keys that are inside a given key range
1362
+ * @param animationGroup defines the animation group on which to operate
1363
+ * @param fromKey defines the lower bound of the range
1364
+ * @param toKey defines the upper bound of the range
1365
+ * @param dontCloneAnimations defines whether or not the animations should be cloned before clipping the keys. Default is false, so animations will be cloned
1366
+ * @returns the animationGroup stripped from all the keys outside the given range
1367
+ */
1368
+ static ClipKeysInPlace(t, e, i, n) {
1369
+ return V.ClipInPlace(t, e, i, n, !1);
1370
+ }
1371
+ /**
1372
+ * Creates a new animation, keeping only the frames that are inside a given frame range
1373
+ * @param sourceAnimationGroup defines the animation group on which to operate
1374
+ * @param fromFrame defines the lower bound of the range
1375
+ * @param toFrame defines the upper bound of the range
1376
+ * @param name defines the name of the new animation group. If not provided, use the same name as animationGroup
1377
+ * @param dontCloneAnimations defines whether or not the animations should be cloned before clipping the frames. Default is false, so animations will be cloned
1378
+ * @returns a new animation group stripped from all the frames outside the given range
1379
+ */
1380
+ static ClipFrames(t, e, i, n, s) {
1381
+ const a = t.clone(n || t.name);
1382
+ return V.ClipFramesInPlace(a, e, i, s);
1383
+ }
1384
+ /**
1385
+ * Updates an existing animation, keeping only the frames that are inside a given frame range
1386
+ * @param animationGroup defines the animation group on which to operate
1387
+ * @param fromFrame defines the lower bound of the range
1388
+ * @param toFrame defines the upper bound of the range
1389
+ * @param dontCloneAnimations defines whether or not the animations should be cloned before clipping the frames. Default is false, so animations will be cloned
1390
+ * @returns the animationGroup stripped from all the frames outside the given range
1391
+ */
1392
+ static ClipFramesInPlace(t, e, i, n) {
1393
+ return V.ClipInPlace(t, e, i, n, !0);
1394
+ }
1395
+ /**
1396
+ * Updates an existing animation, keeping only the keys that are inside a given key or frame range
1397
+ * @param animationGroup defines the animation group on which to operate
1398
+ * @param start defines the lower bound of the range
1399
+ * @param end defines the upper bound of the range
1400
+ * @param dontCloneAnimations defines whether or not the animations should be cloned before clipping the keys. Default is false, so animations will be cloned
1401
+ * @param useFrame defines if the range is defined by frame numbers or key indices (default is false which means use key indices)
1402
+ * @returns the animationGroup stripped from all the keys outside the given range
1403
+ */
1404
+ static ClipInPlace(t, e, i, n, s = !1) {
1405
+ let a = Number.MAX_VALUE, r = -Number.MAX_VALUE;
1406
+ const o = t.targetedAnimations;
1407
+ for (let l = 0; l < o.length; l++) {
1408
+ const u = o[l], c = n ? u.animation : u.animation.clone();
1409
+ s && (c.createKeyForFrame(e), c.createKeyForFrame(i));
1410
+ const g = c.getKeys(), d = [];
1411
+ let _ = Number.MAX_VALUE;
1412
+ for (let m = 0; m < g.length; m++) {
1413
+ const b = g[m];
1414
+ if (!s && m >= e && m <= i || s && b.frame >= e && b.frame <= i) {
1415
+ const O = {
1416
+ frame: b.frame,
1417
+ value: b.value.clone ? b.value.clone() : b.value,
1418
+ inTangent: b.inTangent,
1419
+ outTangent: b.outTangent,
1420
+ interpolation: b.interpolation,
1421
+ lockedTangent: b.lockedTangent
1422
+ };
1423
+ _ === Number.MAX_VALUE && (_ = O.frame), O.frame -= _, d.push(O);
1424
+ }
1425
+ }
1426
+ if (d.length === 0) {
1427
+ o.splice(l, 1), l--;
1428
+ continue;
1429
+ }
1430
+ a > d[0].frame && (a = d[0].frame), r < d[d.length - 1].frame && (r = d[d.length - 1].frame), c.setKeys(d, !0), u.animation = c;
1431
+ }
1432
+ return t._from = a, t._to = r, t;
1433
+ }
1434
+ /**
1435
+ * Returns the string "AnimationGroup"
1436
+ * @returns "AnimationGroup"
1437
+ */
1438
+ getClassName() {
1439
+ return "AnimationGroup";
1440
+ }
1441
+ /**
1442
+ * Creates a detailed string about the object
1443
+ * @param fullDetails defines if the output string will support multiple levels of logging within scene loading
1444
+ * @returns a string representing the object
1445
+ */
1446
+ toString(t) {
1447
+ let e = "Name: " + this.name;
1448
+ return e += ", type: " + this.getClassName(), t && (e += ", from: " + this._from, e += ", to: " + this._to, e += ", isStarted: " + this._isStarted, e += ", speedRatio: " + this._speedRatio, e += ", targetedAnimations length: " + this._targetedAnimations.length, e += ", animatables length: " + this._animatables.length), e;
1449
+ }
1450
+ }
1451
+ export {
1452
+ V as AnimationGroup,
1453
+ q as TargetedAnimation
1454
+ };