@babylonjs/core 6.12.5 → 6.14.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 (62) hide show
  1. package/Animations/animationGroup.d.ts +19 -0
  2. package/Animations/animationGroup.js +58 -0
  3. package/Animations/animationGroup.js.map +1 -1
  4. package/Animations/runtimeAnimation.d.ts +10 -10
  5. package/Animations/runtimeAnimation.js +31 -30
  6. package/Animations/runtimeAnimation.js.map +1 -1
  7. package/Cameras/Inputs/freeCameraMouseInput.js +1 -0
  8. package/Cameras/Inputs/freeCameraMouseInput.js.map +1 -1
  9. package/DeviceInput/webDeviceInputSystem.js +3 -3
  10. package/DeviceInput/webDeviceInputSystem.js.map +1 -1
  11. package/Engines/nativeEngine.js +2 -1
  12. package/Engines/nativeEngine.js.map +1 -1
  13. package/Engines/thinEngine.js +2 -2
  14. package/Engines/thinEngine.js.map +1 -1
  15. package/Lights/spotLight.js +2 -2
  16. package/Lights/spotLight.js.map +1 -1
  17. package/Materials/Node/nodeMaterial.js +1 -0
  18. package/Materials/Node/nodeMaterial.js.map +1 -1
  19. package/Materials/PBR/pbrBaseMaterial.d.ts +3 -3
  20. package/Materials/PBR/pbrBaseMaterial.js +3 -3
  21. package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
  22. package/Materials/PBR/pbrMaterial.d.ts +3 -3
  23. package/Materials/PBR/pbrMaterial.js +3 -3
  24. package/Materials/PBR/pbrMaterial.js.map +1 -1
  25. package/Materials/Textures/rawTexture2DArray.d.ts +4 -2
  26. package/Materials/Textures/rawTexture2DArray.js +3 -2
  27. package/Materials/Textures/rawTexture2DArray.js.map +1 -1
  28. package/Materials/Textures/rawTexture3D.d.ts +4 -2
  29. package/Materials/Textures/rawTexture3D.js +3 -2
  30. package/Materials/Textures/rawTexture3D.js.map +1 -1
  31. package/Maths/math.vector.js +11 -7
  32. package/Maths/math.vector.js.map +1 -1
  33. package/Misc/precisionDate.js +2 -2
  34. package/Misc/precisionDate.js.map +1 -1
  35. package/NOTICE.md +2 -0
  36. package/Physics/v1/Plugins/ammoJSPlugin.d.ts +1 -1
  37. package/Physics/v1/Plugins/ammoJSPlugin.js.map +1 -1
  38. package/Physics/v1/Plugins/cannonJSPlugin.d.ts +1 -1
  39. package/Physics/v1/Plugins/cannonJSPlugin.js +1 -1
  40. package/Physics/v1/Plugins/cannonJSPlugin.js.map +1 -1
  41. package/Physics/v1/Plugins/oimoJSPlugin.js.map +1 -1
  42. package/Physics/v2/Plugins/havokPlugin.js +6 -0
  43. package/Physics/v2/Plugins/havokPlugin.js.map +1 -1
  44. package/Physics/v2/physicsConstraint.d.ts +28 -2
  45. package/Physics/v2/physicsConstraint.js +21 -1
  46. package/Physics/v2/physicsConstraint.js.map +1 -1
  47. package/Physics/v2/physicsShape.d.ts +22 -19
  48. package/Physics/v2/physicsShape.js +22 -19
  49. package/Physics/v2/physicsShape.js.map +1 -1
  50. package/Shaders/ShadersInclude/pbrBlockAmbientOcclusion.js +1 -1
  51. package/Shaders/ShadersInclude/pbrBlockAmbientOcclusion.js.map +1 -1
  52. package/Shaders/ShadersInclude/pbrBlockAnisotropic.js +1 -1
  53. package/Shaders/ShadersInclude/pbrBlockAnisotropic.js.map +1 -1
  54. package/Shaders/ShadersInclude/pbrBlockClearcoat.js +9 -1
  55. package/Shaders/ShadersInclude/pbrBlockClearcoat.js.map +1 -1
  56. package/Shaders/ShadersInclude/pbrBlockReflectivity.js +10 -1
  57. package/Shaders/ShadersInclude/pbrBlockReflectivity.js.map +1 -1
  58. package/Shaders/ShadersInclude/pbrBlockSheen.js +5 -1
  59. package/Shaders/ShadersInclude/pbrBlockSheen.js.map +1 -1
  60. package/Shaders/ShadersInclude/pbrBlockSubSurface.js +5 -1
  61. package/Shaders/ShadersInclude/pbrBlockSubSurface.js.map +1 -1
  62. package/package.json +3 -2
@@ -135,6 +135,25 @@ export declare class AnimationGroup implements IDisposable {
135
135
  */
136
136
  get playOrder(): number;
137
137
  set playOrder(value: number);
138
+ /**
139
+ * Allows the animations of the animation group to blend with current running animations
140
+ * Note: this method should be called after all targeted animations have been added to the group
141
+ * @param blendingSpeed defines the blending speed to use
142
+ */
143
+ enableBlending(blendingSpeed: number): void;
144
+ /**
145
+ * Disable animation blending
146
+ */
147
+ disableBlending(): void;
148
+ /**
149
+ * Merge the array of animation groups into a new animation group
150
+ * @param animationGroups List of animation groups to merge
151
+ * @param disposeSource If true, animation groups will be disposed after being merged (default: true)
152
+ * @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)
153
+ * @param weight Weight for the new animation group. If not provided, it will inherit the weight from the first animation group of the array
154
+ * @returns The new animation group or null if no animation groups were passed
155
+ */
156
+ static MergeAnimationGroups(animationGroups: Array<AnimationGroup>, disposeSource?: boolean, normalize?: boolean, weight?: number): Nullable<AnimationGroup>;
138
157
  /**
139
158
  * Instantiates a new Animation Group.
140
159
  * This helps managing several animations at once.
@@ -152,6 +152,64 @@ export class AnimationGroup {
152
152
  this._scene.sortActiveAnimatables();
153
153
  }
154
154
  }
155
+ /**
156
+ * Allows the animations of the animation group to blend with current running animations
157
+ * Note: this method should be called after all targeted animations have been added to the group
158
+ * @param blendingSpeed defines the blending speed to use
159
+ */
160
+ enableBlending(blendingSpeed) {
161
+ for (let i = 0; i < this._targetedAnimations.length; ++i) {
162
+ this._targetedAnimations[i].animation.enableBlending = true;
163
+ this._targetedAnimations[i].animation.blendingSpeed = blendingSpeed;
164
+ }
165
+ }
166
+ /**
167
+ * Disable animation blending
168
+ */
169
+ disableBlending() {
170
+ for (let i = 0; i < this._targetedAnimations.length; ++i) {
171
+ this._targetedAnimations[i].animation.enableBlending = false;
172
+ }
173
+ }
174
+ /**
175
+ * Merge the array of animation groups into a new animation group
176
+ * @param animationGroups List of animation groups to merge
177
+ * @param disposeSource If true, animation groups will be disposed after being merged (default: true)
178
+ * @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)
179
+ * @param weight Weight for the new animation group. If not provided, it will inherit the weight from the first animation group of the array
180
+ * @returns The new animation group or null if no animation groups were passed
181
+ */
182
+ static MergeAnimationGroups(animationGroups, disposeSource = true, normalize = false, weight) {
183
+ if (animationGroups.length === 0) {
184
+ return null;
185
+ }
186
+ weight = weight !== null && weight !== void 0 ? weight : animationGroups[0].weight;
187
+ let beginFrame = Number.MAX_VALUE;
188
+ let endFrame = Number.MIN_VALUE;
189
+ if (normalize) {
190
+ for (const animationGroup of animationGroups) {
191
+ if (animationGroup.from < beginFrame) {
192
+ beginFrame = animationGroup.from;
193
+ }
194
+ if (animationGroup.to > endFrame) {
195
+ endFrame = animationGroup.to;
196
+ }
197
+ }
198
+ }
199
+ const mergedAnimationGroup = new AnimationGroup(animationGroups[0].name + "_merged", animationGroups[0]._scene, weight);
200
+ for (const animationGroup of animationGroups) {
201
+ if (normalize) {
202
+ animationGroup.normalize(beginFrame, endFrame);
203
+ }
204
+ for (const targetedAnimation of animationGroup.targetedAnimations) {
205
+ mergedAnimationGroup.addTargetedAnimation(targetedAnimation.animation, targetedAnimation.target);
206
+ }
207
+ if (disposeSource) {
208
+ animationGroup.dispose();
209
+ }
210
+ }
211
+ return mergedAnimationGroup;
212
+ }
155
213
  /**
156
214
  * Instantiates a new Animation Group.
157
215
  * This helps managing several animations at once.
@@ -1 +1 @@
1
- {"version":3,"file":"animationGroup.js","sourceRoot":"","sources":["../../../../dev/core/src/Animations/animationGroup.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAIxC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAGrD,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC;;GAEG;AACH,MAAM,OAAO,iBAAiB;IAU1B;;;OAGG;IACI,YAAY;QACf,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAED;;;OAGG;IACI,SAA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","sourcesContent":["import type { Animatable } from \"./animatable\";\r\nimport { Animation } from \"./animation\";\r\nimport type { IAnimationKey } from \"./animationKey\";\r\n\r\nimport type { Scene, IDisposable } from \"../scene\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport type { Nullable } from \"../types\";\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\n\r\nimport type { AbstractScene } from \"../abstractScene\";\r\nimport { Tags } from \"../Misc/tags\";\r\n\r\n/**\r\n * This class defines the direct association between an animation and a target\r\n */\r\nexport class TargetedAnimation {\r\n /**\r\n * Animation to perform\r\n */\r\n public animation: Animation;\r\n /**\r\n * Target to animate\r\n */\r\n public target: any;\r\n\r\n /**\r\n * Returns the string \"TargetedAnimation\"\r\n * @returns \"TargetedAnimation\"\r\n */\r\n public getClassName(): string {\r\n return \"TargetedAnimation\";\r\n }\r\n\r\n /**\r\n * Serialize the object\r\n * @returns the JSON object representing the current entity\r\n */\r\n public serialize(): any {\r\n const serializationObject: any = {};\r\n serializationObject.animation = this.animation.serialize();\r\n serializationObject.targetId = this.target.id;\r\n\r\n return serializationObject;\r\n }\r\n}\r\n\r\n/**\r\n * Use this class to create coordinated animations on multiple targets\r\n */\r\nexport class AnimationGroup implements IDisposable {\r\n private _scene: Scene;\r\n\r\n private _targetedAnimations = new Array<TargetedAnimation>();\r\n private _animatables = new Array<Animatable>();\r\n private _from = Number.MAX_VALUE;\r\n private _to = -Number.MAX_VALUE;\r\n private _isStarted: boolean;\r\n private _isPaused: boolean;\r\n private _speedRatio = 1;\r\n private _loopAnimation = false;\r\n private _isAdditive = false;\r\n private _weight = -1;\r\n private _playOrder = 0;\r\n\r\n /** @internal */\r\n public _parentContainer: Nullable<AbstractScene> = null;\r\n\r\n /**\r\n * Gets or sets the unique id of the node\r\n */\r\n public uniqueId: number;\r\n\r\n /**\r\n * This observable will notify when one animation have ended\r\n */\r\n public onAnimationEndObservable = new Observable<TargetedAnimation>();\r\n\r\n /**\r\n * Observer raised when one animation loops\r\n */\r\n public onAnimationLoopObservable = new Observable<TargetedAnimation>();\r\n\r\n /**\r\n * Observer raised when all animations have looped\r\n */\r\n public onAnimationGroupLoopObservable = new Observable<AnimationGroup>();\r\n\r\n /**\r\n * This observable will notify when all animations have ended.\r\n */\r\n public onAnimationGroupEndObservable = new Observable<AnimationGroup>();\r\n\r\n /**\r\n * This observable will notify when all animations have paused.\r\n */\r\n public onAnimationGroupPauseObservable = new Observable<AnimationGroup>();\r\n\r\n /**\r\n * This observable will notify when all animations are playing.\r\n */\r\n public onAnimationGroupPlayObservable = new Observable<AnimationGroup>();\r\n\r\n /**\r\n * Gets or sets an object used to store user defined information for the node\r\n */\r\n public metadata: any = null;\r\n\r\n /**\r\n * Gets the first frame\r\n */\r\n public get from(): number {\r\n return this._from;\r\n }\r\n\r\n /**\r\n * Gets the last frame\r\n */\r\n public get to(): number {\r\n return this._to;\r\n }\r\n\r\n /**\r\n * Define if the animations are started\r\n */\r\n public get isStarted(): boolean {\r\n return this._isStarted;\r\n }\r\n\r\n /**\r\n * Gets a value indicating that the current group is playing\r\n */\r\n public get isPlaying(): boolean {\r\n return this._isStarted && !this._isPaused;\r\n }\r\n\r\n /**\r\n * Gets or sets the speed ratio to use for all animations\r\n */\r\n public get speedRatio(): number {\r\n return this._speedRatio;\r\n }\r\n\r\n /**\r\n * Gets or sets the speed ratio to use for all animations\r\n */\r\n public set speedRatio(value: number) {\r\n if (this._speedRatio === value) {\r\n return;\r\n }\r\n\r\n this._speedRatio = value;\r\n\r\n for (let index = 0; index < this._animatables.length; index++) {\r\n const animatable = this._animatables[index];\r\n animatable.speedRatio = this._speedRatio;\r\n }\r\n }\r\n\r\n /**\r\n * Gets or sets if all animations should loop or not\r\n */\r\n public get loopAnimation(): boolean {\r\n return this._loopAnimation;\r\n }\r\n\r\n public set loopAnimation(value: boolean) {\r\n if (this._loopAnimation === value) {\r\n return;\r\n }\r\n\r\n this._loopAnimation = value;\r\n\r\n for (let index = 0; index < this._animatables.length; index++) {\r\n const animatable = this._animatables[index];\r\n animatable.loopAnimation = this._loopAnimation;\r\n }\r\n }\r\n\r\n /**\r\n * Gets or sets if all animations should be evaluated additively\r\n */\r\n public get isAdditive(): boolean {\r\n return this._isAdditive;\r\n }\r\n\r\n public set isAdditive(value: boolean) {\r\n if (this._isAdditive === value) {\r\n return;\r\n }\r\n\r\n this._isAdditive = value;\r\n\r\n for (let index = 0; index < this._animatables.length; index++) {\r\n const animatable = this._animatables[index];\r\n animatable.isAdditive = this._isAdditive;\r\n }\r\n }\r\n\r\n /**\r\n * Gets or sets the weight to apply to all animations of the group\r\n */\r\n public get weight(): number {\r\n return this._weight;\r\n }\r\n\r\n public set weight(value: number) {\r\n if (this._weight === value) {\r\n return;\r\n }\r\n\r\n this._weight = value;\r\n this.setWeightForAllAnimatables(this._weight);\r\n }\r\n\r\n /**\r\n * Gets the targeted animations for this animation group\r\n */\r\n public get targetedAnimations(): Array<TargetedAnimation> {\r\n return this._targetedAnimations;\r\n }\r\n\r\n /**\r\n * returning the list of animatables controlled by this animation group.\r\n */\r\n public get animatables(): Array<Animatable> {\r\n return this._animatables;\r\n }\r\n\r\n /**\r\n * Gets the list of target animations\r\n */\r\n public get children() {\r\n return this._targetedAnimations;\r\n }\r\n\r\n /**\r\n * Gets or sets the order of play of the animation group (default: 0)\r\n */\r\n public get playOrder() {\r\n return this._playOrder;\r\n }\r\n\r\n public set playOrder(value: number) {\r\n if (this._playOrder === value) {\r\n return;\r\n }\r\n\r\n this._playOrder = value;\r\n\r\n if (this._animatables.length > 0) {\r\n for (let i = 0; i < this._animatables.length; i++) {\r\n this._animatables[i].playOrder = this._playOrder;\r\n }\r\n\r\n this._scene.sortActiveAnimatables();\r\n }\r\n }\r\n\r\n /**\r\n * Instantiates a new Animation Group.\r\n * This helps managing several animations at once.\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/groupAnimations\r\n * @param name Defines the name of the group\r\n * @param scene Defines the scene the group belongs to\r\n * @param weight Defines the weight to use for animations in the group (-1.0 by default, meaning \"no weight\")\r\n * @param playOrder Defines the order of play of the animation group (default is 0)\r\n */\r\n public constructor(\r\n /** The name of the animation group */\r\n public name: string,\r\n scene: Nullable<Scene> = null,\r\n weight = -1,\r\n playOrder = 0\r\n ) {\r\n this._scene = scene || EngineStore.LastCreatedScene!;\r\n this._weight = weight;\r\n this._playOrder = playOrder;\r\n this.uniqueId = this._scene.getUniqueId();\r\n\r\n this._scene.addAnimationGroup(this);\r\n }\r\n\r\n /**\r\n * Add an animation (with its target) in the group\r\n * @param animation defines the animation we want to add\r\n * @param target defines the target of the animation\r\n * @returns the TargetedAnimation object\r\n */\r\n public addTargetedAnimation(animation: Animation, target: any): TargetedAnimation {\r\n const targetedAnimation = new TargetedAnimation();\r\n targetedAnimation.animation = animation;\r\n targetedAnimation.target = target;\r\n\r\n const keys = animation.getKeys();\r\n if (this._from > keys[0].frame) {\r\n this._from = keys[0].frame;\r\n }\r\n\r\n if (this._to < keys[keys.length - 1].frame) {\r\n this._to = keys[keys.length - 1].frame;\r\n }\r\n\r\n this._targetedAnimations.push(targetedAnimation);\r\n\r\n return targetedAnimation;\r\n }\r\n\r\n /**\r\n * Remove an animation from the group\r\n * @param animation defines the animation we want to remove\r\n */\r\n public removeTargetedAnimation(animation: Animation) {\r\n for (let index = this._targetedAnimations.length - 1; index > -1; index--) {\r\n const targetedAnimation = this._targetedAnimations[index];\r\n if (targetedAnimation.animation === animation) {\r\n this._targetedAnimations.splice(index, 1);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * This function will normalize every animation in the group to make sure they all go from beginFrame to endFrame\r\n * It can add constant keys at begin or end\r\n * @param beginFrame defines the new begin frame for all animations or the smallest begin frame of all animations if null (defaults to null)\r\n * @param endFrame defines the new end frame for all animations or the largest end frame of all animations if null (defaults to null)\r\n * @returns the animation group\r\n */\r\n public normalize(beginFrame: Nullable<number> = null, endFrame: Nullable<number> = null): AnimationGroup {\r\n if (beginFrame == null) {\r\n beginFrame = this._from;\r\n }\r\n if (endFrame == null) {\r\n endFrame = this._to;\r\n }\r\n\r\n for (let index = 0; index < this._targetedAnimations.length; index++) {\r\n const targetedAnimation = this._targetedAnimations[index];\r\n const keys = targetedAnimation.animation.getKeys();\r\n const startKey = keys[0];\r\n const endKey = keys[keys.length - 1];\r\n\r\n if (startKey.frame > beginFrame) {\r\n const newKey: IAnimationKey = {\r\n frame: beginFrame,\r\n value: startKey.value,\r\n inTangent: startKey.inTangent,\r\n outTangent: startKey.outTangent,\r\n interpolation: startKey.interpolation,\r\n };\r\n keys.splice(0, 0, newKey);\r\n }\r\n\r\n if (endKey.frame < endFrame) {\r\n const newKey: IAnimationKey = {\r\n frame: endFrame,\r\n value: endKey.value,\r\n inTangent: endKey.inTangent,\r\n outTangent: endKey.outTangent,\r\n interpolation: endKey.interpolation,\r\n };\r\n keys.push(newKey);\r\n }\r\n }\r\n\r\n this._from = beginFrame;\r\n this._to = endFrame;\r\n\r\n return this;\r\n }\r\n\r\n private _animationLoopCount: number;\r\n private _animationLoopFlags: boolean[] = [];\r\n\r\n private _processLoop(animatable: Animatable, targetedAnimation: TargetedAnimation, index: number) {\r\n animatable.onAnimationLoop = () => {\r\n this.onAnimationLoopObservable.notifyObservers(targetedAnimation);\r\n\r\n if (this._animationLoopFlags[index]) {\r\n return;\r\n }\r\n\r\n this._animationLoopFlags[index] = true;\r\n\r\n this._animationLoopCount++;\r\n if (this._animationLoopCount === this._targetedAnimations.length) {\r\n this.onAnimationGroupLoopObservable.notifyObservers(this);\r\n this._animationLoopCount = 0;\r\n this._animationLoopFlags.length = 0;\r\n }\r\n };\r\n }\r\n\r\n /**\r\n * Start all animations on given targets\r\n * @param loop defines if animations must loop\r\n * @param speedRatio defines the ratio to apply to animation speed (1 by default)\r\n * @param from defines the from key (optional)\r\n * @param to defines the to key (optional)\r\n * @param isAdditive defines the additive state for the resulting animatables (optional)\r\n * @returns the current animation group\r\n */\r\n public start(loop = false, speedRatio = 1, from?: number, to?: number, isAdditive?: boolean): AnimationGroup {\r\n if (this._isStarted || this._targetedAnimations.length === 0) {\r\n return this;\r\n }\r\n\r\n this._loopAnimation = loop;\r\n\r\n this._animationLoopCount = 0;\r\n this._animationLoopFlags.length = 0;\r\n\r\n for (let index = 0; index < this._targetedAnimations.length; index++) {\r\n const targetedAnimation = this._targetedAnimations[index];\r\n const animatable = this._scene.beginDirectAnimation(\r\n targetedAnimation.target,\r\n [targetedAnimation.animation],\r\n from !== undefined ? from : this._from,\r\n to !== undefined ? to : this._to,\r\n loop,\r\n speedRatio,\r\n undefined,\r\n undefined,\r\n isAdditive !== undefined ? isAdditive : this._isAdditive\r\n );\r\n animatable.weight = this._weight;\r\n animatable.playOrder = this._playOrder;\r\n animatable.onAnimationEnd = () => {\r\n this.onAnimationEndObservable.notifyObservers(targetedAnimation);\r\n this._checkAnimationGroupEnded(animatable);\r\n };\r\n\r\n this._processLoop(animatable, targetedAnimation, index);\r\n this._animatables.push(animatable);\r\n }\r\n\r\n this._scene.sortActiveAnimatables();\r\n\r\n this._speedRatio = speedRatio;\r\n\r\n this._isStarted = true;\r\n this._isPaused = false;\r\n\r\n this.onAnimationGroupPlayObservable.notifyObservers(this);\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Pause all animations\r\n * @returns the animation group\r\n */\r\n public pause(): AnimationGroup {\r\n if (!this._isStarted) {\r\n return this;\r\n }\r\n\r\n this._isPaused = true;\r\n\r\n for (let index = 0; index < this._animatables.length; index++) {\r\n const animatable = this._animatables[index];\r\n animatable.pause();\r\n }\r\n\r\n this.onAnimationGroupPauseObservable.notifyObservers(this);\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Play all animations to initial state\r\n * This function will start() the animations if they were not started or will restart() them if they were paused\r\n * @param loop defines if animations must loop\r\n * @returns the animation group\r\n */\r\n public play(loop?: boolean): AnimationGroup {\r\n // only if all animatables are ready and exist\r\n if (this.isStarted && this._animatables.length === this._targetedAnimations.length) {\r\n if (loop !== undefined) {\r\n this.loopAnimation = loop;\r\n }\r\n this.restart();\r\n } else {\r\n this.stop();\r\n this.start(loop, this._speedRatio);\r\n }\r\n\r\n this._isPaused = false;\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Reset all animations to initial state\r\n * @returns the animation group\r\n */\r\n public reset(): AnimationGroup {\r\n if (!this._isStarted) {\r\n this.play();\r\n this.goToFrame(0);\r\n this.stop();\r\n return this;\r\n }\r\n\r\n for (let index = 0; index < this._animatables.length; index++) {\r\n const animatable = this._animatables[index];\r\n animatable.reset();\r\n }\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Restart animations from key 0\r\n * @returns the animation group\r\n */\r\n public restart(): AnimationGroup {\r\n if (!this._isStarted) {\r\n return this;\r\n }\r\n\r\n for (let index = 0; index < this._animatables.length; index++) {\r\n const animatable = this._animatables[index];\r\n animatable.restart();\r\n }\r\n\r\n this.onAnimationGroupPlayObservable.notifyObservers(this);\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Stop all animations\r\n * @returns the animation group\r\n */\r\n public stop(): AnimationGroup {\r\n if (!this._isStarted) {\r\n return this;\r\n }\r\n\r\n const list = this._animatables.slice();\r\n for (let index = 0; index < list.length; index++) {\r\n list[index].stop(undefined, undefined, true);\r\n }\r\n\r\n // We will take care of removing all stopped animatables\r\n let curIndex = 0;\r\n for (let index = 0; index < this._scene._activeAnimatables.length; index++) {\r\n const animatable = this._scene._activeAnimatables[index];\r\n if (animatable._runtimeAnimations.length > 0) {\r\n this._scene._activeAnimatables[curIndex++] = animatable;\r\n }\r\n }\r\n this._scene._activeAnimatables.length = curIndex;\r\n\r\n this._isStarted = false;\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Set animation weight for all animatables\r\n *\r\n * @since 6.12.4\r\n * You can pass the weight to the AnimationGroup constructor, or use the weight property to set it after the group has been created,\r\n * making it easier to define the overall animation weight than calling setWeightForAllAnimatables() after the animation group has been started\r\n * @param weight defines the weight to use\r\n * @returns the animationGroup\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#animation-weights\r\n */\r\n public setWeightForAllAnimatables(weight: number): AnimationGroup {\r\n for (let index = 0; index < this._animatables.length; index++) {\r\n const animatable = this._animatables[index];\r\n animatable.weight = weight;\r\n }\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Synchronize and normalize all animatables with a source animatable\r\n * @param root defines the root animatable to synchronize with (null to stop synchronizing)\r\n * @returns the animationGroup\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#animation-weights\r\n */\r\n public syncAllAnimationsWith(root: Nullable<Animatable>): AnimationGroup {\r\n for (let index = 0; index < this._animatables.length; index++) {\r\n const animatable = this._animatables[index];\r\n animatable.syncWith(root);\r\n }\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Goes to a specific frame in this animation group\r\n * @param frame the frame number to go to\r\n * @returns the animationGroup\r\n */\r\n public goToFrame(frame: number): AnimationGroup {\r\n if (!this._isStarted) {\r\n return this;\r\n }\r\n\r\n for (let index = 0; index < this._animatables.length; index++) {\r\n const animatable = this._animatables[index];\r\n animatable.goToFrame(frame);\r\n }\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Dispose all associated resources\r\n */\r\n public dispose(): void {\r\n this._targetedAnimations.length = 0;\r\n this._animatables.length = 0;\r\n\r\n // Remove from scene\r\n const index = this._scene.animationGroups.indexOf(this);\r\n\r\n if (index > -1) {\r\n this._scene.animationGroups.splice(index, 1);\r\n }\r\n\r\n if (this._parentContainer) {\r\n const index = this._parentContainer.animationGroups.indexOf(this);\r\n if (index > -1) {\r\n this._parentContainer.animationGroups.splice(index, 1);\r\n }\r\n this._parentContainer = null;\r\n }\r\n\r\n this.onAnimationEndObservable.clear();\r\n this.onAnimationGroupEndObservable.clear();\r\n this.onAnimationGroupPauseObservable.clear();\r\n this.onAnimationGroupPlayObservable.clear();\r\n this.onAnimationLoopObservable.clear();\r\n this.onAnimationGroupLoopObservable.clear();\r\n }\r\n\r\n private _checkAnimationGroupEnded(animatable: Animatable) {\r\n // animatable should be taken out of the array\r\n const idx = this._animatables.indexOf(animatable);\r\n if (idx > -1) {\r\n this._animatables.splice(idx, 1);\r\n }\r\n\r\n // all animatables were removed? animation group ended!\r\n if (this._animatables.length === 0) {\r\n this._isStarted = false;\r\n this.onAnimationGroupEndObservable.notifyObservers(this);\r\n }\r\n }\r\n\r\n /**\r\n * Clone the current animation group and returns a copy\r\n * @param newName defines the name of the new group\r\n * @param targetConverter defines an optional function used to convert current animation targets to new ones\r\n * @param cloneAnimations defines if the animations should be cloned or referenced\r\n * @returns the new animation group\r\n */\r\n public clone(newName: string, targetConverter?: (oldTarget: any) => any, cloneAnimations = false): AnimationGroup {\r\n const newGroup = new AnimationGroup(newName || this.name, this._scene);\r\n\r\n for (const targetAnimation of this._targetedAnimations) {\r\n newGroup.addTargetedAnimation(\r\n cloneAnimations ? targetAnimation.animation.clone() : targetAnimation.animation,\r\n targetConverter ? targetConverter(targetAnimation.target) : targetAnimation.target\r\n );\r\n }\r\n\r\n return newGroup;\r\n }\r\n\r\n /**\r\n * Serializes the animationGroup to an object\r\n * @returns Serialized object\r\n */\r\n public serialize(): any {\r\n const serializationObject: any = {};\r\n\r\n serializationObject.name = this.name;\r\n serializationObject.from = this.from;\r\n serializationObject.to = this.to;\r\n serializationObject.targetedAnimations = [];\r\n for (let targetedAnimationIndex = 0; targetedAnimationIndex < this.targetedAnimations.length; targetedAnimationIndex++) {\r\n const targetedAnimation = this.targetedAnimations[targetedAnimationIndex];\r\n serializationObject.targetedAnimations[targetedAnimationIndex] = targetedAnimation.serialize();\r\n }\r\n\r\n if (Tags && Tags.HasTags(this)) {\r\n serializationObject.tags = Tags.GetTags(this);\r\n }\r\n\r\n // Metadata\r\n if (this.metadata) {\r\n serializationObject.metadata = this.metadata;\r\n }\r\n\r\n return serializationObject;\r\n }\r\n\r\n // Statics\r\n /**\r\n * Returns a new AnimationGroup object parsed from the source provided.\r\n * @param parsedAnimationGroup defines the source\r\n * @param scene defines the scene that will receive the animationGroup\r\n * @returns a new AnimationGroup\r\n */\r\n public static Parse(parsedAnimationGroup: any, scene: Scene): AnimationGroup {\r\n const animationGroup = new AnimationGroup(parsedAnimationGroup.name, scene);\r\n for (let i = 0; i < parsedAnimationGroup.targetedAnimations.length; i++) {\r\n const targetedAnimation = parsedAnimationGroup.targetedAnimations[i];\r\n const animation = Animation.Parse(targetedAnimation.animation);\r\n const id = targetedAnimation.targetId;\r\n if (targetedAnimation.animation.property === \"influence\") {\r\n // morph target animation\r\n const morphTarget = scene.getMorphTargetById(id);\r\n if (morphTarget) {\r\n animationGroup.addTargetedAnimation(animation, morphTarget);\r\n }\r\n } else {\r\n const targetNode = scene.getNodeById(id);\r\n\r\n if (targetNode != null) {\r\n animationGroup.addTargetedAnimation(animation, targetNode);\r\n }\r\n }\r\n }\r\n\r\n if (parsedAnimationGroup.from !== null && parsedAnimationGroup.to !== null) {\r\n animationGroup.normalize(parsedAnimationGroup.from, parsedAnimationGroup.to);\r\n }\r\n\r\n if (Tags) {\r\n Tags.AddTagsTo(animationGroup, parsedAnimationGroup.tags);\r\n }\r\n\r\n if (parsedAnimationGroup.metadata !== undefined) {\r\n animationGroup.metadata = parsedAnimationGroup.metadata;\r\n }\r\n\r\n return animationGroup;\r\n }\r\n\r\n /**\r\n * Convert the keyframes for all animations belonging to the group to be relative to a given reference frame.\r\n * @param sourceAnimationGroup defines the AnimationGroup containing animations to convert\r\n * @param referenceFrame defines the frame that keyframes in the range will be relative to\r\n * @param range defines the name of the AnimationRange belonging to the animations in the group to convert\r\n * @param cloneOriginal defines whether or not to clone the group and convert the clone or convert the original group (default is false)\r\n * @param clonedName defines the name of the resulting cloned AnimationGroup if cloneOriginal is true\r\n * @returns a new AnimationGroup if cloneOriginal is true or the original AnimationGroup if cloneOriginal is false\r\n */\r\n public static MakeAnimationAdditive(sourceAnimationGroup: AnimationGroup, referenceFrame = 0, range?: string, cloneOriginal = false, clonedName?: string): AnimationGroup {\r\n let animationGroup = sourceAnimationGroup;\r\n if (cloneOriginal) {\r\n animationGroup = sourceAnimationGroup.clone(clonedName || animationGroup.name);\r\n }\r\n\r\n const targetedAnimations = animationGroup.targetedAnimations;\r\n for (let index = 0; index < targetedAnimations.length; index++) {\r\n const targetedAnimation = targetedAnimations[index];\r\n Animation.MakeAnimationAdditive(targetedAnimation.animation, referenceFrame, range);\r\n }\r\n\r\n animationGroup.isAdditive = true;\r\n\r\n return animationGroup;\r\n }\r\n\r\n /**\r\n * Returns the string \"AnimationGroup\"\r\n * @returns \"AnimationGroup\"\r\n */\r\n public getClassName(): string {\r\n return \"AnimationGroup\";\r\n }\r\n\r\n /**\r\n * Creates a detailed string about the object\r\n * @param fullDetails defines if the output string will support multiple levels of logging within scene loading\r\n * @returns a string representing the object\r\n */\r\n public toString(fullDetails?: boolean): string {\r\n let ret = \"Name: \" + this.name;\r\n ret += \", type: \" + this.getClassName();\r\n if (fullDetails) {\r\n ret += \", from: \" + this._from;\r\n ret += \", to: \" + this._to;\r\n ret += \", isStarted: \" + this._isStarted;\r\n ret += \", speedRatio: \" + this._speedRatio;\r\n ret += \", targetedAnimations length: \" + this._targetedAnimations.length;\r\n ret += \", animatables length: \" + this._animatables;\r\n }\r\n return ret;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"animationGroup.js","sourceRoot":"","sources":["../../../../dev/core/src/Animations/animationGroup.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAIxC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAGrD,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC;;GAEG;AACH,MAAM,OAAO,iBAAiB;IAU1B;;;OAGG;IACI,YAAY;QACf,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAED;;;OAGG;IACI,SAAS;QACZ,MAAM,mBAAmB,GAAQ,EAAE,CAAC;QACpC,mBAAmB,CAAC,SAAS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,GAAG,IAAI,CAAC,IAAI,CAAC;QAC/B,GAAG,IAAI,UAAU,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;QACxC,IAAI,WAAW,EAAE;YACb,GAAG,IAAI,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC;YAC/B,GAAG,IAAI,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC;YAC3B,GAAG,IAAI,eAAe,GAAG,IAAI,CAAC,UAAU,CAAC;YACzC,GAAG,IAAI,gBAAgB,GAAG,IAAI,CAAC,WAAW,CAAC;YAC3C,GAAG,IAAI,+BAA+B,GAAG,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC;YACzE,GAAG,IAAI,wBAAwB,GAAG,IAAI,CAAC,YAAY,CAAC;SACvD;QACD,OAAO,GAAG,CAAC;IACf,CAAC;CACJ","sourcesContent":["import type { Animatable } from \"./animatable\";\r\nimport { Animation } from \"./animation\";\r\nimport type { IAnimationKey } from \"./animationKey\";\r\n\r\nimport type { Scene, IDisposable } from \"../scene\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport type { Nullable } from \"../types\";\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\n\r\nimport type { AbstractScene } from \"../abstractScene\";\r\nimport { Tags } from \"../Misc/tags\";\r\n\r\n/**\r\n * This class defines the direct association between an animation and a target\r\n */\r\nexport class TargetedAnimation {\r\n /**\r\n * Animation to perform\r\n */\r\n public animation: Animation;\r\n /**\r\n * Target to animate\r\n */\r\n public target: any;\r\n\r\n /**\r\n * Returns the string \"TargetedAnimation\"\r\n * @returns \"TargetedAnimation\"\r\n */\r\n public getClassName(): string {\r\n return \"TargetedAnimation\";\r\n }\r\n\r\n /**\r\n * Serialize the object\r\n * @returns the JSON object representing the current entity\r\n */\r\n public serialize(): any {\r\n const serializationObject: any = {};\r\n serializationObject.animation = this.animation.serialize();\r\n serializationObject.targetId = this.target.id;\r\n\r\n return serializationObject;\r\n }\r\n}\r\n\r\n/**\r\n * Use this class to create coordinated animations on multiple targets\r\n */\r\nexport class AnimationGroup implements IDisposable {\r\n private _scene: Scene;\r\n\r\n private _targetedAnimations = new Array<TargetedAnimation>();\r\n private _animatables = new Array<Animatable>();\r\n private _from = Number.MAX_VALUE;\r\n private _to = -Number.MAX_VALUE;\r\n private _isStarted: boolean;\r\n private _isPaused: boolean;\r\n private _speedRatio = 1;\r\n private _loopAnimation = false;\r\n private _isAdditive = false;\r\n private _weight = -1;\r\n private _playOrder = 0;\r\n\r\n /** @internal */\r\n public _parentContainer: Nullable<AbstractScene> = null;\r\n\r\n /**\r\n * Gets or sets the unique id of the node\r\n */\r\n public uniqueId: number;\r\n\r\n /**\r\n * This observable will notify when one animation have ended\r\n */\r\n public onAnimationEndObservable = new Observable<TargetedAnimation>();\r\n\r\n /**\r\n * Observer raised when one animation loops\r\n */\r\n public onAnimationLoopObservable = new Observable<TargetedAnimation>();\r\n\r\n /**\r\n * Observer raised when all animations have looped\r\n */\r\n public onAnimationGroupLoopObservable = new Observable<AnimationGroup>();\r\n\r\n /**\r\n * This observable will notify when all animations have ended.\r\n */\r\n public onAnimationGroupEndObservable = new Observable<AnimationGroup>();\r\n\r\n /**\r\n * This observable will notify when all animations have paused.\r\n */\r\n public onAnimationGroupPauseObservable = new Observable<AnimationGroup>();\r\n\r\n /**\r\n * This observable will notify when all animations are playing.\r\n */\r\n public onAnimationGroupPlayObservable = new Observable<AnimationGroup>();\r\n\r\n /**\r\n * Gets or sets an object used to store user defined information for the node\r\n */\r\n public metadata: any = null;\r\n\r\n /**\r\n * Gets the first frame\r\n */\r\n public get from(): number {\r\n return this._from;\r\n }\r\n\r\n /**\r\n * Gets the last frame\r\n */\r\n public get to(): number {\r\n return this._to;\r\n }\r\n\r\n /**\r\n * Define if the animations are started\r\n */\r\n public get isStarted(): boolean {\r\n return this._isStarted;\r\n }\r\n\r\n /**\r\n * Gets a value indicating that the current group is playing\r\n */\r\n public get isPlaying(): boolean {\r\n return this._isStarted && !this._isPaused;\r\n }\r\n\r\n /**\r\n * Gets or sets the speed ratio to use for all animations\r\n */\r\n public get speedRatio(): number {\r\n return this._speedRatio;\r\n }\r\n\r\n /**\r\n * Gets or sets the speed ratio to use for all animations\r\n */\r\n public set speedRatio(value: number) {\r\n if (this._speedRatio === value) {\r\n return;\r\n }\r\n\r\n this._speedRatio = value;\r\n\r\n for (let index = 0; index < this._animatables.length; index++) {\r\n const animatable = this._animatables[index];\r\n animatable.speedRatio = this._speedRatio;\r\n }\r\n }\r\n\r\n /**\r\n * Gets or sets if all animations should loop or not\r\n */\r\n public get loopAnimation(): boolean {\r\n return this._loopAnimation;\r\n }\r\n\r\n public set loopAnimation(value: boolean) {\r\n if (this._loopAnimation === value) {\r\n return;\r\n }\r\n\r\n this._loopAnimation = value;\r\n\r\n for (let index = 0; index < this._animatables.length; index++) {\r\n const animatable = this._animatables[index];\r\n animatable.loopAnimation = this._loopAnimation;\r\n }\r\n }\r\n\r\n /**\r\n * Gets or sets if all animations should be evaluated additively\r\n */\r\n public get isAdditive(): boolean {\r\n return this._isAdditive;\r\n }\r\n\r\n public set isAdditive(value: boolean) {\r\n if (this._isAdditive === value) {\r\n return;\r\n }\r\n\r\n this._isAdditive = value;\r\n\r\n for (let index = 0; index < this._animatables.length; index++) {\r\n const animatable = this._animatables[index];\r\n animatable.isAdditive = this._isAdditive;\r\n }\r\n }\r\n\r\n /**\r\n * Gets or sets the weight to apply to all animations of the group\r\n */\r\n public get weight(): number {\r\n return this._weight;\r\n }\r\n\r\n public set weight(value: number) {\r\n if (this._weight === value) {\r\n return;\r\n }\r\n\r\n this._weight = value;\r\n this.setWeightForAllAnimatables(this._weight);\r\n }\r\n\r\n /**\r\n * Gets the targeted animations for this animation group\r\n */\r\n public get targetedAnimations(): Array<TargetedAnimation> {\r\n return this._targetedAnimations;\r\n }\r\n\r\n /**\r\n * returning the list of animatables controlled by this animation group.\r\n */\r\n public get animatables(): Array<Animatable> {\r\n return this._animatables;\r\n }\r\n\r\n /**\r\n * Gets the list of target animations\r\n */\r\n public get children() {\r\n return this._targetedAnimations;\r\n }\r\n\r\n /**\r\n * Gets or sets the order of play of the animation group (default: 0)\r\n */\r\n public get playOrder() {\r\n return this._playOrder;\r\n }\r\n\r\n public set playOrder(value: number) {\r\n if (this._playOrder === value) {\r\n return;\r\n }\r\n\r\n this._playOrder = value;\r\n\r\n if (this._animatables.length > 0) {\r\n for (let i = 0; i < this._animatables.length; i++) {\r\n this._animatables[i].playOrder = this._playOrder;\r\n }\r\n\r\n this._scene.sortActiveAnimatables();\r\n }\r\n }\r\n\r\n /**\r\n * Allows the animations of the animation group to blend with current running animations\r\n * Note: this method should be called after all targeted animations have been added to the group\r\n * @param blendingSpeed defines the blending speed to use\r\n */\r\n public enableBlending(blendingSpeed: number) {\r\n for (let i = 0; i < this._targetedAnimations.length; ++i) {\r\n this._targetedAnimations[i].animation.enableBlending = true;\r\n this._targetedAnimations[i].animation.blendingSpeed = blendingSpeed;\r\n }\r\n }\r\n\r\n /**\r\n * Disable animation blending\r\n */\r\n public disableBlending() {\r\n for (let i = 0; i < this._targetedAnimations.length; ++i) {\r\n this._targetedAnimations[i].animation.enableBlending = false;\r\n }\r\n }\r\n\r\n /**\r\n * Merge the array of animation groups into a new animation group\r\n * @param animationGroups List of animation groups to merge\r\n * @param disposeSource If true, animation groups will be disposed after being merged (default: true)\r\n * @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)\r\n * @param weight Weight for the new animation group. If not provided, it will inherit the weight from the first animation group of the array\r\n * @returns The new animation group or null if no animation groups were passed\r\n */\r\n public static MergeAnimationGroups(animationGroups: Array<AnimationGroup>, disposeSource = true, normalize = false, weight?: number): Nullable<AnimationGroup> {\r\n if (animationGroups.length === 0) {\r\n return null;\r\n }\r\n\r\n weight = weight ?? animationGroups[0].weight;\r\n\r\n let beginFrame = Number.MAX_VALUE;\r\n let endFrame = Number.MIN_VALUE;\r\n\r\n if (normalize) {\r\n for (const animationGroup of animationGroups) {\r\n if (animationGroup.from < beginFrame) {\r\n beginFrame = animationGroup.from;\r\n }\r\n\r\n if (animationGroup.to > endFrame) {\r\n endFrame = animationGroup.to;\r\n }\r\n }\r\n }\r\n\r\n const mergedAnimationGroup = new AnimationGroup(animationGroups[0].name + \"_merged\", animationGroups[0]._scene, weight);\r\n\r\n for (const animationGroup of animationGroups) {\r\n if (normalize) {\r\n animationGroup.normalize(beginFrame, endFrame);\r\n }\r\n\r\n for (const targetedAnimation of animationGroup.targetedAnimations) {\r\n mergedAnimationGroup.addTargetedAnimation(targetedAnimation.animation, targetedAnimation.target);\r\n }\r\n\r\n if (disposeSource) {\r\n animationGroup.dispose();\r\n }\r\n }\r\n\r\n return mergedAnimationGroup;\r\n }\r\n\r\n /**\r\n * Instantiates a new Animation Group.\r\n * This helps managing several animations at once.\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/groupAnimations\r\n * @param name Defines the name of the group\r\n * @param scene Defines the scene the group belongs to\r\n * @param weight Defines the weight to use for animations in the group (-1.0 by default, meaning \"no weight\")\r\n * @param playOrder Defines the order of play of the animation group (default is 0)\r\n */\r\n public constructor(\r\n /** The name of the animation group */\r\n public name: string,\r\n scene: Nullable<Scene> = null,\r\n weight = -1,\r\n playOrder = 0\r\n ) {\r\n this._scene = scene || EngineStore.LastCreatedScene!;\r\n this._weight = weight;\r\n this._playOrder = playOrder;\r\n this.uniqueId = this._scene.getUniqueId();\r\n\r\n this._scene.addAnimationGroup(this);\r\n }\r\n\r\n /**\r\n * Add an animation (with its target) in the group\r\n * @param animation defines the animation we want to add\r\n * @param target defines the target of the animation\r\n * @returns the TargetedAnimation object\r\n */\r\n public addTargetedAnimation(animation: Animation, target: any): TargetedAnimation {\r\n const targetedAnimation = new TargetedAnimation();\r\n targetedAnimation.animation = animation;\r\n targetedAnimation.target = target;\r\n\r\n const keys = animation.getKeys();\r\n if (this._from > keys[0].frame) {\r\n this._from = keys[0].frame;\r\n }\r\n\r\n if (this._to < keys[keys.length - 1].frame) {\r\n this._to = keys[keys.length - 1].frame;\r\n }\r\n\r\n this._targetedAnimations.push(targetedAnimation);\r\n\r\n return targetedAnimation;\r\n }\r\n\r\n /**\r\n * Remove an animation from the group\r\n * @param animation defines the animation we want to remove\r\n */\r\n public removeTargetedAnimation(animation: Animation) {\r\n for (let index = this._targetedAnimations.length - 1; index > -1; index--) {\r\n const targetedAnimation = this._targetedAnimations[index];\r\n if (targetedAnimation.animation === animation) {\r\n this._targetedAnimations.splice(index, 1);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * This function will normalize every animation in the group to make sure they all go from beginFrame to endFrame\r\n * It can add constant keys at begin or end\r\n * @param beginFrame defines the new begin frame for all animations or the smallest begin frame of all animations if null (defaults to null)\r\n * @param endFrame defines the new end frame for all animations or the largest end frame of all animations if null (defaults to null)\r\n * @returns the animation group\r\n */\r\n public normalize(beginFrame: Nullable<number> = null, endFrame: Nullable<number> = null): AnimationGroup {\r\n if (beginFrame == null) {\r\n beginFrame = this._from;\r\n }\r\n if (endFrame == null) {\r\n endFrame = this._to;\r\n }\r\n\r\n for (let index = 0; index < this._targetedAnimations.length; index++) {\r\n const targetedAnimation = this._targetedAnimations[index];\r\n const keys = targetedAnimation.animation.getKeys();\r\n const startKey = keys[0];\r\n const endKey = keys[keys.length - 1];\r\n\r\n if (startKey.frame > beginFrame) {\r\n const newKey: IAnimationKey = {\r\n frame: beginFrame,\r\n value: startKey.value,\r\n inTangent: startKey.inTangent,\r\n outTangent: startKey.outTangent,\r\n interpolation: startKey.interpolation,\r\n };\r\n keys.splice(0, 0, newKey);\r\n }\r\n\r\n if (endKey.frame < endFrame) {\r\n const newKey: IAnimationKey = {\r\n frame: endFrame,\r\n value: endKey.value,\r\n inTangent: endKey.inTangent,\r\n outTangent: endKey.outTangent,\r\n interpolation: endKey.interpolation,\r\n };\r\n keys.push(newKey);\r\n }\r\n }\r\n\r\n this._from = beginFrame;\r\n this._to = endFrame;\r\n\r\n return this;\r\n }\r\n\r\n private _animationLoopCount: number;\r\n private _animationLoopFlags: boolean[] = [];\r\n\r\n private _processLoop(animatable: Animatable, targetedAnimation: TargetedAnimation, index: number) {\r\n animatable.onAnimationLoop = () => {\r\n this.onAnimationLoopObservable.notifyObservers(targetedAnimation);\r\n\r\n if (this._animationLoopFlags[index]) {\r\n return;\r\n }\r\n\r\n this._animationLoopFlags[index] = true;\r\n\r\n this._animationLoopCount++;\r\n if (this._animationLoopCount === this._targetedAnimations.length) {\r\n this.onAnimationGroupLoopObservable.notifyObservers(this);\r\n this._animationLoopCount = 0;\r\n this._animationLoopFlags.length = 0;\r\n }\r\n };\r\n }\r\n\r\n /**\r\n * Start all animations on given targets\r\n * @param loop defines if animations must loop\r\n * @param speedRatio defines the ratio to apply to animation speed (1 by default)\r\n * @param from defines the from key (optional)\r\n * @param to defines the to key (optional)\r\n * @param isAdditive defines the additive state for the resulting animatables (optional)\r\n * @returns the current animation group\r\n */\r\n public start(loop = false, speedRatio = 1, from?: number, to?: number, isAdditive?: boolean): AnimationGroup {\r\n if (this._isStarted || this._targetedAnimations.length === 0) {\r\n return this;\r\n }\r\n\r\n this._loopAnimation = loop;\r\n\r\n this._animationLoopCount = 0;\r\n this._animationLoopFlags.length = 0;\r\n\r\n for (let index = 0; index < this._targetedAnimations.length; index++) {\r\n const targetedAnimation = this._targetedAnimations[index];\r\n const animatable = this._scene.beginDirectAnimation(\r\n targetedAnimation.target,\r\n [targetedAnimation.animation],\r\n from !== undefined ? from : this._from,\r\n to !== undefined ? to : this._to,\r\n loop,\r\n speedRatio,\r\n undefined,\r\n undefined,\r\n isAdditive !== undefined ? isAdditive : this._isAdditive\r\n );\r\n animatable.weight = this._weight;\r\n animatable.playOrder = this._playOrder;\r\n animatable.onAnimationEnd = () => {\r\n this.onAnimationEndObservable.notifyObservers(targetedAnimation);\r\n this._checkAnimationGroupEnded(animatable);\r\n };\r\n\r\n this._processLoop(animatable, targetedAnimation, index);\r\n this._animatables.push(animatable);\r\n }\r\n\r\n this._scene.sortActiveAnimatables();\r\n\r\n this._speedRatio = speedRatio;\r\n\r\n this._isStarted = true;\r\n this._isPaused = false;\r\n\r\n this.onAnimationGroupPlayObservable.notifyObservers(this);\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Pause all animations\r\n * @returns the animation group\r\n */\r\n public pause(): AnimationGroup {\r\n if (!this._isStarted) {\r\n return this;\r\n }\r\n\r\n this._isPaused = true;\r\n\r\n for (let index = 0; index < this._animatables.length; index++) {\r\n const animatable = this._animatables[index];\r\n animatable.pause();\r\n }\r\n\r\n this.onAnimationGroupPauseObservable.notifyObservers(this);\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Play all animations to initial state\r\n * This function will start() the animations if they were not started or will restart() them if they were paused\r\n * @param loop defines if animations must loop\r\n * @returns the animation group\r\n */\r\n public play(loop?: boolean): AnimationGroup {\r\n // only if all animatables are ready and exist\r\n if (this.isStarted && this._animatables.length === this._targetedAnimations.length) {\r\n if (loop !== undefined) {\r\n this.loopAnimation = loop;\r\n }\r\n this.restart();\r\n } else {\r\n this.stop();\r\n this.start(loop, this._speedRatio);\r\n }\r\n\r\n this._isPaused = false;\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Reset all animations to initial state\r\n * @returns the animation group\r\n */\r\n public reset(): AnimationGroup {\r\n if (!this._isStarted) {\r\n this.play();\r\n this.goToFrame(0);\r\n this.stop();\r\n return this;\r\n }\r\n\r\n for (let index = 0; index < this._animatables.length; index++) {\r\n const animatable = this._animatables[index];\r\n animatable.reset();\r\n }\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Restart animations from key 0\r\n * @returns the animation group\r\n */\r\n public restart(): AnimationGroup {\r\n if (!this._isStarted) {\r\n return this;\r\n }\r\n\r\n for (let index = 0; index < this._animatables.length; index++) {\r\n const animatable = this._animatables[index];\r\n animatable.restart();\r\n }\r\n\r\n this.onAnimationGroupPlayObservable.notifyObservers(this);\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Stop all animations\r\n * @returns the animation group\r\n */\r\n public stop(): AnimationGroup {\r\n if (!this._isStarted) {\r\n return this;\r\n }\r\n\r\n const list = this._animatables.slice();\r\n for (let index = 0; index < list.length; index++) {\r\n list[index].stop(undefined, undefined, true);\r\n }\r\n\r\n // We will take care of removing all stopped animatables\r\n let curIndex = 0;\r\n for (let index = 0; index < this._scene._activeAnimatables.length; index++) {\r\n const animatable = this._scene._activeAnimatables[index];\r\n if (animatable._runtimeAnimations.length > 0) {\r\n this._scene._activeAnimatables[curIndex++] = animatable;\r\n }\r\n }\r\n this._scene._activeAnimatables.length = curIndex;\r\n\r\n this._isStarted = false;\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Set animation weight for all animatables\r\n *\r\n * @since 6.12.4\r\n * You can pass the weight to the AnimationGroup constructor, or use the weight property to set it after the group has been created,\r\n * making it easier to define the overall animation weight than calling setWeightForAllAnimatables() after the animation group has been started\r\n * @param weight defines the weight to use\r\n * @returns the animationGroup\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#animation-weights\r\n */\r\n public setWeightForAllAnimatables(weight: number): AnimationGroup {\r\n for (let index = 0; index < this._animatables.length; index++) {\r\n const animatable = this._animatables[index];\r\n animatable.weight = weight;\r\n }\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Synchronize and normalize all animatables with a source animatable\r\n * @param root defines the root animatable to synchronize with (null to stop synchronizing)\r\n * @returns the animationGroup\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#animation-weights\r\n */\r\n public syncAllAnimationsWith(root: Nullable<Animatable>): AnimationGroup {\r\n for (let index = 0; index < this._animatables.length; index++) {\r\n const animatable = this._animatables[index];\r\n animatable.syncWith(root);\r\n }\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Goes to a specific frame in this animation group\r\n * @param frame the frame number to go to\r\n * @returns the animationGroup\r\n */\r\n public goToFrame(frame: number): AnimationGroup {\r\n if (!this._isStarted) {\r\n return this;\r\n }\r\n\r\n for (let index = 0; index < this._animatables.length; index++) {\r\n const animatable = this._animatables[index];\r\n animatable.goToFrame(frame);\r\n }\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Dispose all associated resources\r\n */\r\n public dispose(): void {\r\n this._targetedAnimations.length = 0;\r\n this._animatables.length = 0;\r\n\r\n // Remove from scene\r\n const index = this._scene.animationGroups.indexOf(this);\r\n\r\n if (index > -1) {\r\n this._scene.animationGroups.splice(index, 1);\r\n }\r\n\r\n if (this._parentContainer) {\r\n const index = this._parentContainer.animationGroups.indexOf(this);\r\n if (index > -1) {\r\n this._parentContainer.animationGroups.splice(index, 1);\r\n }\r\n this._parentContainer = null;\r\n }\r\n\r\n this.onAnimationEndObservable.clear();\r\n this.onAnimationGroupEndObservable.clear();\r\n this.onAnimationGroupPauseObservable.clear();\r\n this.onAnimationGroupPlayObservable.clear();\r\n this.onAnimationLoopObservable.clear();\r\n this.onAnimationGroupLoopObservable.clear();\r\n }\r\n\r\n private _checkAnimationGroupEnded(animatable: Animatable) {\r\n // animatable should be taken out of the array\r\n const idx = this._animatables.indexOf(animatable);\r\n if (idx > -1) {\r\n this._animatables.splice(idx, 1);\r\n }\r\n\r\n // all animatables were removed? animation group ended!\r\n if (this._animatables.length === 0) {\r\n this._isStarted = false;\r\n this.onAnimationGroupEndObservable.notifyObservers(this);\r\n }\r\n }\r\n\r\n /**\r\n * Clone the current animation group and returns a copy\r\n * @param newName defines the name of the new group\r\n * @param targetConverter defines an optional function used to convert current animation targets to new ones\r\n * @param cloneAnimations defines if the animations should be cloned or referenced\r\n * @returns the new animation group\r\n */\r\n public clone(newName: string, targetConverter?: (oldTarget: any) => any, cloneAnimations = false): AnimationGroup {\r\n const newGroup = new AnimationGroup(newName || this.name, this._scene);\r\n\r\n for (const targetAnimation of this._targetedAnimations) {\r\n newGroup.addTargetedAnimation(\r\n cloneAnimations ? targetAnimation.animation.clone() : targetAnimation.animation,\r\n targetConverter ? targetConverter(targetAnimation.target) : targetAnimation.target\r\n );\r\n }\r\n\r\n return newGroup;\r\n }\r\n\r\n /**\r\n * Serializes the animationGroup to an object\r\n * @returns Serialized object\r\n */\r\n public serialize(): any {\r\n const serializationObject: any = {};\r\n\r\n serializationObject.name = this.name;\r\n serializationObject.from = this.from;\r\n serializationObject.to = this.to;\r\n serializationObject.targetedAnimations = [];\r\n for (let targetedAnimationIndex = 0; targetedAnimationIndex < this.targetedAnimations.length; targetedAnimationIndex++) {\r\n const targetedAnimation = this.targetedAnimations[targetedAnimationIndex];\r\n serializationObject.targetedAnimations[targetedAnimationIndex] = targetedAnimation.serialize();\r\n }\r\n\r\n if (Tags && Tags.HasTags(this)) {\r\n serializationObject.tags = Tags.GetTags(this);\r\n }\r\n\r\n // Metadata\r\n if (this.metadata) {\r\n serializationObject.metadata = this.metadata;\r\n }\r\n\r\n return serializationObject;\r\n }\r\n\r\n // Statics\r\n /**\r\n * Returns a new AnimationGroup object parsed from the source provided.\r\n * @param parsedAnimationGroup defines the source\r\n * @param scene defines the scene that will receive the animationGroup\r\n * @returns a new AnimationGroup\r\n */\r\n public static Parse(parsedAnimationGroup: any, scene: Scene): AnimationGroup {\r\n const animationGroup = new AnimationGroup(parsedAnimationGroup.name, scene);\r\n for (let i = 0; i < parsedAnimationGroup.targetedAnimations.length; i++) {\r\n const targetedAnimation = parsedAnimationGroup.targetedAnimations[i];\r\n const animation = Animation.Parse(targetedAnimation.animation);\r\n const id = targetedAnimation.targetId;\r\n if (targetedAnimation.animation.property === \"influence\") {\r\n // morph target animation\r\n const morphTarget = scene.getMorphTargetById(id);\r\n if (morphTarget) {\r\n animationGroup.addTargetedAnimation(animation, morphTarget);\r\n }\r\n } else {\r\n const targetNode = scene.getNodeById(id);\r\n\r\n if (targetNode != null) {\r\n animationGroup.addTargetedAnimation(animation, targetNode);\r\n }\r\n }\r\n }\r\n\r\n if (parsedAnimationGroup.from !== null && parsedAnimationGroup.to !== null) {\r\n animationGroup.normalize(parsedAnimationGroup.from, parsedAnimationGroup.to);\r\n }\r\n\r\n if (Tags) {\r\n Tags.AddTagsTo(animationGroup, parsedAnimationGroup.tags);\r\n }\r\n\r\n if (parsedAnimationGroup.metadata !== undefined) {\r\n animationGroup.metadata = parsedAnimationGroup.metadata;\r\n }\r\n\r\n return animationGroup;\r\n }\r\n\r\n /**\r\n * Convert the keyframes for all animations belonging to the group to be relative to a given reference frame.\r\n * @param sourceAnimationGroup defines the AnimationGroup containing animations to convert\r\n * @param referenceFrame defines the frame that keyframes in the range will be relative to\r\n * @param range defines the name of the AnimationRange belonging to the animations in the group to convert\r\n * @param cloneOriginal defines whether or not to clone the group and convert the clone or convert the original group (default is false)\r\n * @param clonedName defines the name of the resulting cloned AnimationGroup if cloneOriginal is true\r\n * @returns a new AnimationGroup if cloneOriginal is true or the original AnimationGroup if cloneOriginal is false\r\n */\r\n public static MakeAnimationAdditive(sourceAnimationGroup: AnimationGroup, referenceFrame = 0, range?: string, cloneOriginal = false, clonedName?: string): AnimationGroup {\r\n let animationGroup = sourceAnimationGroup;\r\n if (cloneOriginal) {\r\n animationGroup = sourceAnimationGroup.clone(clonedName || animationGroup.name);\r\n }\r\n\r\n const targetedAnimations = animationGroup.targetedAnimations;\r\n for (let index = 0; index < targetedAnimations.length; index++) {\r\n const targetedAnimation = targetedAnimations[index];\r\n Animation.MakeAnimationAdditive(targetedAnimation.animation, referenceFrame, range);\r\n }\r\n\r\n animationGroup.isAdditive = true;\r\n\r\n return animationGroup;\r\n }\r\n\r\n /**\r\n * Returns the string \"AnimationGroup\"\r\n * @returns \"AnimationGroup\"\r\n */\r\n public getClassName(): string {\r\n return \"AnimationGroup\";\r\n }\r\n\r\n /**\r\n * Creates a detailed string about the object\r\n * @param fullDetails defines if the output string will support multiple levels of logging within scene loading\r\n * @returns a string representing the object\r\n */\r\n public toString(fullDetails?: boolean): string {\r\n let ret = \"Name: \" + this.name;\r\n ret += \", type: \" + this.getClassName();\r\n if (fullDetails) {\r\n ret += \", from: \" + this._from;\r\n ret += \", to: \" + this._to;\r\n ret += \", isStarted: \" + this._isStarted;\r\n ret += \", speedRatio: \" + this._speedRatio;\r\n ret += \", targetedAnimations length: \" + this._targetedAnimations.length;\r\n ret += \", animatables length: \" + this._animatables;\r\n }\r\n return ret;\r\n }\r\n}\r\n"]}
@@ -72,17 +72,17 @@ export declare class RuntimeAnimation {
72
72
  */
73
73
  private _weight;
74
74
  /**
75
- * The ratio offset of the runtime animation
75
+ * The absolute frame offset of the runtime animation
76
76
  */
77
- private _ratioOffset;
77
+ private _absoluteFrameOffset;
78
78
  /**
79
- * The previous delay of the runtime animation
79
+ * The previous elapsed time (since start of animation) of the runtime animation
80
80
  */
81
- private _previousDelay;
81
+ private _previousElapsedTime;
82
82
  /**
83
- * The previous ratio of the runtime animation
83
+ * The previous absolute frame of the runtime animation (meaning, without taking into account the from/to values, only the elapsed time and the fps)
84
84
  */
85
- private _previousRatio;
85
+ private _previousAbsoluteFrame;
86
86
  private _enableBlending;
87
87
  private _keys;
88
88
  private _minFrame;
@@ -167,13 +167,13 @@ export declare class RuntimeAnimation {
167
167
  _prepareForSpeedRatioChange(newSpeedRatio: number): void;
168
168
  /**
169
169
  * Execute the current animation
170
- * @param delay defines the delay to add to the current frame
171
- * @param from defines the lower bound of the animation range
172
- * @param to defines the upper bound of the animation range
170
+ * @param elapsedTimeSinceAnimationStart defines the elapsed time (in milliseconds) since the animation was started
171
+ * @param from defines the lower frame of the animation range
172
+ * @param to defines the upper frame of the animation range
173
173
  * @param loop defines if the current animation must loop
174
174
  * @param speedRatio defines the current speed ratio
175
175
  * @param weight defines the weight of the animation (default is -1 so no weight)
176
176
  * @returns a boolean indicating if the animation is running
177
177
  */
178
- animate(delay: number, from: number, to: number, loop: boolean, speedRatio: number, weight?: number): boolean;
178
+ animate(elapsedTimeSinceAnimationStart: number, from: number, to: number, loop: boolean, speedRatio: number, weight?: number): boolean;
179
179
  }
@@ -105,17 +105,17 @@ export class RuntimeAnimation {
105
105
  */
106
106
  this._weight = 1.0;
107
107
  /**
108
- * The ratio offset of the runtime animation
108
+ * The absolute frame offset of the runtime animation
109
109
  */
110
- this._ratioOffset = 0;
110
+ this._absoluteFrameOffset = 0;
111
111
  /**
112
- * The previous delay of the runtime animation
112
+ * The previous elapsed time (since start of animation) of the runtime animation
113
113
  */
114
- this._previousDelay = 0;
114
+ this._previousElapsedTime = 0;
115
115
  /**
116
- * The previous ratio of the runtime animation
116
+ * The previous absolute frame of the runtime animation (meaning, without taking into account the from/to values, only the elapsed time and the fps)
117
117
  */
118
- this._previousRatio = 0;
118
+ this._previousAbsoluteFrame = 0;
119
119
  this._targetIsArray = false;
120
120
  this._animation = animation;
121
121
  this._target = target;
@@ -372,20 +372,20 @@ export class RuntimeAnimation {
372
372
  * @internal Internal use only
373
373
  */
374
374
  _prepareForSpeedRatioChange(newSpeedRatio) {
375
- const newRatio = (this._previousDelay * (this._animation.framePerSecond * newSpeedRatio)) / 1000.0;
376
- this._ratioOffset = this._previousRatio - newRatio;
375
+ const newAbsoluteFrame = (this._previousElapsedTime * (this._animation.framePerSecond * newSpeedRatio)) / 1000.0;
376
+ this._absoluteFrameOffset = this._previousAbsoluteFrame - newAbsoluteFrame;
377
377
  }
378
378
  /**
379
379
  * Execute the current animation
380
- * @param delay defines the delay to add to the current frame
381
- * @param from defines the lower bound of the animation range
382
- * @param to defines the upper bound of the animation range
380
+ * @param elapsedTimeSinceAnimationStart defines the elapsed time (in milliseconds) since the animation was started
381
+ * @param from defines the lower frame of the animation range
382
+ * @param to defines the upper frame of the animation range
383
383
  * @param loop defines if the current animation must loop
384
384
  * @param speedRatio defines the current speed ratio
385
385
  * @param weight defines the weight of the animation (default is -1 so no weight)
386
386
  * @returns a boolean indicating if the animation is running
387
387
  */
388
- animate(delay, from, to, loop, speedRatio, weight = -1.0) {
388
+ animate(elapsedTimeSinceAnimationStart, from, to, loop, speedRatio, weight = -1.0) {
389
389
  const animation = this._animation;
390
390
  const targetPropertyPath = animation.targetPropertyPath;
391
391
  if (!targetPropertyPath || targetPropertyPath.length < 1) {
@@ -400,27 +400,27 @@ export class RuntimeAnimation {
400
400
  if (to < this._minFrame || to > this._maxFrame) {
401
401
  to = this._maxFrame;
402
402
  }
403
- const range = to - from;
403
+ const frameRange = to - from;
404
404
  let offsetValue;
405
- // Compute ratio which represents the frame delta between from and to
406
- let ratio = (delay * (animation.framePerSecond * speedRatio)) / 1000.0 + this._ratioOffset;
405
+ // Compute the frame according to the elapsed time and the fps of the animation ("from" and "to" are not factored in!)
406
+ let absoluteFrame = (elapsedTimeSinceAnimationStart * (animation.framePerSecond * speedRatio)) / 1000.0 + this._absoluteFrameOffset;
407
407
  let highLimitValue = 0;
408
408
  // Apply the yoyo function if required
409
409
  if (loop && this._animationState.loopMode === Animation.ANIMATIONLOOPMODE_YOYO) {
410
- const position = (ratio - from) / range;
410
+ const position = (absoluteFrame - from) / frameRange;
411
411
  // Apply the yoyo curve
412
412
  const yoyoPosition = Math.abs(Math.sin(position * Math.PI));
413
413
  // Map the yoyo position back to the range
414
- ratio = yoyoPosition * range + from;
414
+ absoluteFrame = yoyoPosition * frameRange + from;
415
415
  }
416
- this._previousDelay = delay;
417
- this._previousRatio = ratio;
418
- if (!loop && to >= from && ratio >= range) {
416
+ this._previousElapsedTime = elapsedTimeSinceAnimationStart;
417
+ this._previousAbsoluteFrame = absoluteFrame;
418
+ if (!loop && to >= from && absoluteFrame >= frameRange) {
419
419
  // If we are out of range and not looping get back to caller
420
420
  returnValue = false;
421
421
  highLimitValue = animation._getKeyValue(this._maxValue);
422
422
  }
423
- else if (!loop && from >= to && ratio <= range) {
423
+ else if (!loop && from >= to && absoluteFrame <= frameRange) {
424
424
  returnValue = false;
425
425
  highLimitValue = animation._getKeyValue(this._minValue);
426
426
  }
@@ -428,7 +428,7 @@ export class RuntimeAnimation {
428
428
  const keyOffset = to.toString() + from.toString();
429
429
  if (!this._offsetsCache[keyOffset]) {
430
430
  this._animationState.repeatCount = 0;
431
- this._animationState.loopMode = Animation.ANIMATIONLOOPMODE_CYCLE;
431
+ this._animationState.loopMode = Animation.ANIMATIONLOOPMODE_CYCLE; // force a specific codepath in animation._interpolate()!
432
432
  const fromValue = animation._interpolate(from, this._animationState);
433
433
  const toValue = animation._interpolate(to, this._animationState);
434
434
  this._animationState.loopMode = this._getCorrectLoopMode();
@@ -495,16 +495,17 @@ export class RuntimeAnimation {
495
495
  // Compute value
496
496
  let currentFrame;
497
497
  if (this._host && this._host.syncRoot) {
498
+ // If we must sync with an animatable, calculate the current frame based on the frame of the root animatable
498
499
  const syncRoot = this._host.syncRoot;
499
500
  const hostNormalizedFrame = (syncRoot.masterFrame - syncRoot.fromFrame) / (syncRoot.toFrame - syncRoot.fromFrame);
500
- currentFrame = from + (to - from) * hostNormalizedFrame;
501
+ currentFrame = from + frameRange * hostNormalizedFrame;
501
502
  }
502
503
  else {
503
- if ((ratio > 0 && from > to) || (ratio < 0 && from < to)) {
504
- currentFrame = returnValue && range !== 0 ? to + (ratio % range) : from;
504
+ if ((absoluteFrame > 0 && from > to) || (absoluteFrame < 0 && from < to)) {
505
+ currentFrame = returnValue && frameRange !== 0 ? to + (absoluteFrame % frameRange) : from;
505
506
  }
506
507
  else {
507
- currentFrame = returnValue && range !== 0 ? from + (ratio % range) : to;
508
+ currentFrame = returnValue && frameRange !== 0 ? from + (absoluteFrame % frameRange) : to;
508
509
  }
509
510
  }
510
511
  const events = this._events;
@@ -521,7 +522,7 @@ export class RuntimeAnimation {
521
522
  this._animationState.key = speedRatio > 0 ? 0 : animation.getKeys().length - 1;
522
523
  }
523
524
  this._currentFrame = currentFrame;
524
- this._animationState.repeatCount = range === 0 ? 0 : (ratio / range) >> 0;
525
+ this._animationState.repeatCount = frameRange === 0 ? 0 : (absoluteFrame / frameRange) >> 0;
525
526
  this._animationState.highLimitValue = highLimitValue;
526
527
  this._animationState.offsetValue = offsetValue;
527
528
  const currentValue = animation._interpolate(currentFrame, this._animationState);
@@ -532,8 +533,8 @@ export class RuntimeAnimation {
532
533
  for (let index = 0; index < events.length; index++) {
533
534
  // Make sure current frame has passed event frame and that event frame is within the current range
534
535
  // Also, handle both forward and reverse animations
535
- if ((range > 0 && currentFrame >= events[index].frame && events[index].frame >= from) ||
536
- (range < 0 && currentFrame <= events[index].frame && events[index].frame <= from)) {
536
+ if ((frameRange > 0 && currentFrame >= events[index].frame && events[index].frame >= from) ||
537
+ (frameRange < 0 && currentFrame <= events[index].frame && events[index].frame <= from)) {
537
538
  const event = events[index];
538
539
  if (!event.isDone) {
539
540
  // If event should be done only once, remove it.
@@ -543,7 +544,7 @@ export class RuntimeAnimation {
543
544
  }
544
545
  event.isDone = true;
545
546
  event.action(currentFrame);
546
- } // Don't do anything if the event has already be done.
547
+ } // Don't do anything if the event has already been done.
547
548
  }
548
549
  }
549
550
  }