@babylonjs/core 6.12.2 → 6.12.4

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.
@@ -43,6 +43,7 @@ export declare class AnimationGroup implements IDisposable {
43
43
  private _speedRatio;
44
44
  private _loopAnimation;
45
45
  private _isAdditive;
46
+ private _weight;
46
47
  /** @internal */
47
48
  _parentContainer: Nullable<AbstractScene>;
48
49
  /**
@@ -111,6 +112,11 @@ export declare class AnimationGroup implements IDisposable {
111
112
  */
112
113
  get isAdditive(): boolean;
113
114
  set isAdditive(value: boolean);
115
+ /**
116
+ * Gets or sets the weight to apply to all animations of the group
117
+ */
118
+ get weight(): number;
119
+ set weight(value: number);
114
120
  /**
115
121
  * Gets the targeted animations for this animation group
116
122
  */
@@ -129,10 +135,11 @@ export declare class AnimationGroup implements IDisposable {
129
135
  * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/groupAnimations
130
136
  * @param name Defines the name of the group
131
137
  * @param scene Defines the scene the group belongs to
138
+ * @param weight Defines the weight to use for animations in the group (-1.0 by default, meaning "no weight")
132
139
  */
133
140
  constructor(
134
141
  /** The name of the animation group */
135
- name: string, scene?: Nullable<Scene>);
142
+ name: string, scene?: Nullable<Scene>, weight?: number);
136
143
  /**
137
144
  * Add an animation (with its target) in the group
138
145
  * @param animation defines the animation we want to add
@@ -195,6 +202,10 @@ export declare class AnimationGroup implements IDisposable {
195
202
  stop(): AnimationGroup;
196
203
  /**
197
204
  * Set animation weight for all animatables
205
+ *
206
+ * @since 6.12.4
207
+ * You can pass the weight to the AnimationGroup constructor, or use the weight property to set it after the group has been created,
208
+ * making it easier to define the overall animation weight than calling setWeightForAllAnimatables() after the animation group has been started
198
209
  * @param weight defines the weight to use
199
210
  * @returns the animationGroup
200
211
  * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#animation-weights
@@ -103,6 +103,19 @@ export class AnimationGroup {
103
103
  animatable.isAdditive = this._isAdditive;
104
104
  }
105
105
  }
106
+ /**
107
+ * Gets or sets the weight to apply to all animations of the group
108
+ */
109
+ get weight() {
110
+ return this._weight;
111
+ }
112
+ set weight(value) {
113
+ if (this._weight === value) {
114
+ return;
115
+ }
116
+ this._weight = value;
117
+ this.setWeightForAllAnimatables(this._weight);
118
+ }
106
119
  /**
107
120
  * Gets the targeted animations for this animation group
108
121
  */
@@ -127,10 +140,11 @@ export class AnimationGroup {
127
140
  * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/groupAnimations
128
141
  * @param name Defines the name of the group
129
142
  * @param scene Defines the scene the group belongs to
143
+ * @param weight Defines the weight to use for animations in the group (-1.0 by default, meaning "no weight")
130
144
  */
131
145
  constructor(
132
146
  /** The name of the animation group */
133
- name, scene = null) {
147
+ name, scene = null, weight = -1) {
134
148
  this.name = name;
135
149
  this._targetedAnimations = new Array();
136
150
  this._animatables = new Array();
@@ -139,6 +153,7 @@ export class AnimationGroup {
139
153
  this._speedRatio = 1;
140
154
  this._loopAnimation = false;
141
155
  this._isAdditive = false;
156
+ this._weight = -1;
142
157
  /** @internal */
143
158
  this._parentContainer = null;
144
159
  /**
@@ -171,6 +186,7 @@ export class AnimationGroup {
171
186
  this.metadata = null;
172
187
  this._animationLoopFlags = [];
173
188
  this._scene = scene || EngineStore.LastCreatedScene;
189
+ this._weight = weight;
174
190
  this.uniqueId = this._scene.getUniqueId();
175
191
  this._scene.addAnimationGroup(this);
176
192
  }
@@ -284,6 +300,7 @@ export class AnimationGroup {
284
300
  for (let index = 0; index < this._targetedAnimations.length; index++) {
285
301
  const targetedAnimation = this._targetedAnimations[index];
286
302
  const animatable = this._scene.beginDirectAnimation(targetedAnimation.target, [targetedAnimation.animation], from !== undefined ? from : this._from, to !== undefined ? to : this._to, loop, speedRatio, undefined, undefined, isAdditive !== undefined ? isAdditive : this._isAdditive);
303
+ animatable.weight = this._weight;
287
304
  animatable.onAnimationEnd = () => {
288
305
  this.onAnimationEndObservable.notifyObservers(targetedAnimation);
289
306
  this._checkAnimationGroupEnded(animatable);
@@ -392,6 +409,10 @@ export class AnimationGroup {
392
409
  }
393
410
  /**
394
411
  * Set animation weight for all animatables
412
+ *
413
+ * @since 6.12.4
414
+ * You can pass the weight to the AnimationGroup constructor, or use the weight property to set it after the group has been created,
415
+ * making it easier to define the overall animation weight than calling setWeightForAllAnimatables() after the animation group has been started
395
416
  * @param weight defines the weight to use
396
417
  * @returns the animationGroup
397
418
  * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#animation-weights
@@ -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,SAAS;QACZ,MAAM,mBAAmB,GAAQ,EAAE,CAAC;QACpC,mBAAmB,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,CAAC;QAC3D,mBAAmB,CAAC,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;QAE9C,OAAO,mBAAmB,CAAC;IAC/B,CAAC;CACJ;AAED;;GAEG;AACH,MAAM,OAAO,cAAc;IAwDvB;;OAEG;IACH,IAAW,IAAI;QACX,OAAO,IAAI,CAAC,KAAK,CAAC;IACtB,CAAC;IAED;;OAEG;IACH,IAAW,EAAE;QACT,OAAO,IAAI,CAAC,GAAG,CAAC;IACpB,CAAC;IAED;;OAEG;IACH,IAAW,SAAS;QAChB,OAAO,IAAI,CAAC,UAAU,CAAC;IA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,SAAS,EAAE,cAAc,EAAE,KAAK,CAAC,CAAC;SACvF;QAED,cAAc,CAAC,UAAU,GAAG,IAAI,CAAC;QAEjC,OAAO,cAAc,CAAC;IAC1B,CAAC;IAED;;;OAGG;IACI,YAAY;QACf,OAAO,gBAAgB,CAAC;IAC5B,CAAC;IAED;;;;OAIG;IACI,QAAQ,CAAC,WAAqB;QACjC,IAAI,GAAG,GAAG,QAAQ,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\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 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 * 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 */\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 ) {\r\n this._scene = scene || EngineStore.LastCreatedScene!;\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.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._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 * @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,GAAG,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,CAAC;QAC3D,mBAAmB,CAAC,QAAQ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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\";\nimport { Animation } from \"./animation\";\nimport type { IAnimationKey } from \"./animationKey\";\n\nimport type { Scene, IDisposable } from \"../scene\";\nimport { Observable } from \"../Misc/observable\";\nimport type { Nullable } from \"../types\";\nimport { EngineStore } from \"../Engines/engineStore\";\n\nimport type { AbstractScene } from \"../abstractScene\";\nimport { Tags } from \"../Misc/tags\";\n\n/**\n * This class defines the direct association between an animation and a target\n */\nexport class TargetedAnimation {\n /**\n * Animation to perform\n */\n public animation: Animation;\n /**\n * Target to animate\n */\n public target: any;\n\n /**\n * Returns the string \"TargetedAnimation\"\n * @returns \"TargetedAnimation\"\n */\n public getClassName(): string {\n return \"TargetedAnimation\";\n }\n\n /**\n * Serialize the object\n * @returns the JSON object representing the current entity\n */\n public serialize(): any {\n const serializationObject: any = {};\n serializationObject.animation = this.animation.serialize();\n serializationObject.targetId = this.target.id;\n\n return serializationObject;\n }\n}\n\n/**\n * Use this class to create coordinated animations on multiple targets\n */\nexport class AnimationGroup implements IDisposable {\n private _scene: Scene;\n\n private _targetedAnimations = new Array<TargetedAnimation>();\n private _animatables = new Array<Animatable>();\n private _from = Number.MAX_VALUE;\n private _to = -Number.MAX_VALUE;\n private _isStarted: boolean;\n private _isPaused: boolean;\n private _speedRatio = 1;\n private _loopAnimation = false;\n private _isAdditive = false;\n private _weight = -1;\n\n /** @internal */\n public _parentContainer: Nullable<AbstractScene> = null;\n\n /**\n * Gets or sets the unique id of the node\n */\n public uniqueId: number;\n\n /**\n * This observable will notify when one animation have ended\n */\n public onAnimationEndObservable = new Observable<TargetedAnimation>();\n\n /**\n * Observer raised when one animation loops\n */\n public onAnimationLoopObservable = new Observable<TargetedAnimation>();\n\n /**\n * Observer raised when all animations have looped\n */\n public onAnimationGroupLoopObservable = new Observable<AnimationGroup>();\n\n /**\n * This observable will notify when all animations have ended.\n */\n public onAnimationGroupEndObservable = new Observable<AnimationGroup>();\n\n /**\n * This observable will notify when all animations have paused.\n */\n public onAnimationGroupPauseObservable = new Observable<AnimationGroup>();\n\n /**\n * This observable will notify when all animations are playing.\n */\n public onAnimationGroupPlayObservable = new Observable<AnimationGroup>();\n\n /**\n * Gets or sets an object used to store user defined information for the node\n */\n public metadata: any = null;\n\n /**\n * Gets the first frame\n */\n public get from(): number {\n return this._from;\n }\n\n /**\n * Gets the last frame\n */\n public get to(): number {\n return this._to;\n }\n\n /**\n * Define if the animations are started\n */\n public get isStarted(): boolean {\n return this._isStarted;\n }\n\n /**\n * Gets a value indicating that the current group is playing\n */\n public get isPlaying(): boolean {\n return this._isStarted && !this._isPaused;\n }\n\n /**\n * Gets or sets the speed ratio to use for all animations\n */\n public get speedRatio(): number {\n return this._speedRatio;\n }\n\n /**\n * Gets or sets the speed ratio to use for all animations\n */\n public set speedRatio(value: number) {\n if (this._speedRatio === value) {\n return;\n }\n\n this._speedRatio = value;\n\n for (let index = 0; index < this._animatables.length; index++) {\n const animatable = this._animatables[index];\n animatable.speedRatio = this._speedRatio;\n }\n }\n\n /**\n * Gets or sets if all animations should loop or not\n */\n public get loopAnimation(): boolean {\n return this._loopAnimation;\n }\n\n public set loopAnimation(value: boolean) {\n if (this._loopAnimation === value) {\n return;\n }\n\n this._loopAnimation = value;\n\n for (let index = 0; index < this._animatables.length; index++) {\n const animatable = this._animatables[index];\n animatable.loopAnimation = this._loopAnimation;\n }\n }\n\n /**\n * Gets or sets if all animations should be evaluated additively\n */\n public get isAdditive(): boolean {\n return this._isAdditive;\n }\n\n public set isAdditive(value: boolean) {\n if (this._isAdditive === value) {\n return;\n }\n\n this._isAdditive = value;\n\n for (let index = 0; index < this._animatables.length; index++) {\n const animatable = this._animatables[index];\n animatable.isAdditive = this._isAdditive;\n }\n }\n\n /**\n * Gets or sets the weight to apply to all animations of the group\n */\n public get weight(): number {\n return this._weight;\n }\n\n public set weight(value: number) {\n if (this._weight === value) {\n return;\n }\n\n this._weight = value;\n this.setWeightForAllAnimatables(this._weight);\n }\n\n /**\n * Gets the targeted animations for this animation group\n */\n public get targetedAnimations(): Array<TargetedAnimation> {\n return this._targetedAnimations;\n }\n\n /**\n * returning the list of animatables controlled by this animation group.\n */\n public get animatables(): Array<Animatable> {\n return this._animatables;\n }\n\n /**\n * Gets the list of target animations\n */\n public get children() {\n return this._targetedAnimations;\n }\n\n /**\n * Instantiates a new Animation Group.\n * This helps managing several animations at once.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/groupAnimations\n * @param name Defines the name of the group\n * @param scene Defines the scene the group belongs to\n * @param weight Defines the weight to use for animations in the group (-1.0 by default, meaning \"no weight\")\n */\n public constructor(\n /** The name of the animation group */\n public name: string,\n scene: Nullable<Scene> = null,\n weight = -1\n ) {\n this._scene = scene || EngineStore.LastCreatedScene!;\n this._weight = weight;\n this.uniqueId = this._scene.getUniqueId();\n\n this._scene.addAnimationGroup(this);\n }\n\n /**\n * Add an animation (with its target) in the group\n * @param animation defines the animation we want to add\n * @param target defines the target of the animation\n * @returns the TargetedAnimation object\n */\n public addTargetedAnimation(animation: Animation, target: any): TargetedAnimation {\n const targetedAnimation = new TargetedAnimation();\n targetedAnimation.animation = animation;\n targetedAnimation.target = target;\n\n const keys = animation.getKeys();\n if (this._from > keys[0].frame) {\n this._from = keys[0].frame;\n }\n\n if (this._to < keys[keys.length - 1].frame) {\n this._to = keys[keys.length - 1].frame;\n }\n\n this._targetedAnimations.push(targetedAnimation);\n\n return targetedAnimation;\n }\n\n /**\n * Remove an animation from the group\n * @param animation defines the animation we want to remove\n */\n public removeTargetedAnimation(animation: Animation) {\n for (let index = this._targetedAnimations.length - 1; index > -1; index--) {\n const targetedAnimation = this._targetedAnimations[index];\n if (targetedAnimation.animation === animation) {\n this._targetedAnimations.splice(index, 1);\n }\n }\n }\n\n /**\n * This function will normalize every animation in the group to make sure they all go from beginFrame to endFrame\n * It can add constant keys at begin or end\n * @param beginFrame defines the new begin frame for all animations or the smallest begin frame of all animations if null (defaults to null)\n * @param endFrame defines the new end frame for all animations or the largest end frame of all animations if null (defaults to null)\n * @returns the animation group\n */\n public normalize(beginFrame: Nullable<number> = null, endFrame: Nullable<number> = null): AnimationGroup {\n if (beginFrame == null) {\n beginFrame = this._from;\n }\n if (endFrame == null) {\n endFrame = this._to;\n }\n\n for (let index = 0; index < this._targetedAnimations.length; index++) {\n const targetedAnimation = this._targetedAnimations[index];\n const keys = targetedAnimation.animation.getKeys();\n const startKey = keys[0];\n const endKey = keys[keys.length - 1];\n\n if (startKey.frame > beginFrame) {\n const newKey: IAnimationKey = {\n frame: beginFrame,\n value: startKey.value,\n inTangent: startKey.inTangent,\n outTangent: startKey.outTangent,\n interpolation: startKey.interpolation,\n };\n keys.splice(0, 0, newKey);\n }\n\n if (endKey.frame < endFrame) {\n const newKey: IAnimationKey = {\n frame: endFrame,\n value: endKey.value,\n inTangent: endKey.inTangent,\n outTangent: endKey.outTangent,\n interpolation: endKey.interpolation,\n };\n keys.push(newKey);\n }\n }\n\n this._from = beginFrame;\n this._to = endFrame;\n\n return this;\n }\n\n private _animationLoopCount: number;\n private _animationLoopFlags: boolean[] = [];\n\n private _processLoop(animatable: Animatable, targetedAnimation: TargetedAnimation, index: number) {\n animatable.onAnimationLoop = () => {\n this.onAnimationLoopObservable.notifyObservers(targetedAnimation);\n\n if (this._animationLoopFlags[index]) {\n return;\n }\n\n this._animationLoopFlags[index] = true;\n\n this._animationLoopCount++;\n if (this._animationLoopCount === this._targetedAnimations.length) {\n this.onAnimationGroupLoopObservable.notifyObservers(this);\n this._animationLoopCount = 0;\n this._animationLoopFlags.length = 0;\n }\n };\n }\n\n /**\n * Start all animations on given targets\n * @param loop defines if animations must loop\n * @param speedRatio defines the ratio to apply to animation speed (1 by default)\n * @param from defines the from key (optional)\n * @param to defines the to key (optional)\n * @param isAdditive defines the additive state for the resulting animatables (optional)\n * @returns the current animation group\n */\n public start(loop = false, speedRatio = 1, from?: number, to?: number, isAdditive?: boolean): AnimationGroup {\n if (this._isStarted || this._targetedAnimations.length === 0) {\n return this;\n }\n\n this._loopAnimation = loop;\n\n this._animationLoopCount = 0;\n this._animationLoopFlags.length = 0;\n\n for (let index = 0; index < this._targetedAnimations.length; index++) {\n const targetedAnimation = this._targetedAnimations[index];\n const animatable = this._scene.beginDirectAnimation(\n targetedAnimation.target,\n [targetedAnimation.animation],\n from !== undefined ? from : this._from,\n to !== undefined ? to : this._to,\n loop,\n speedRatio,\n undefined,\n undefined,\n isAdditive !== undefined ? isAdditive : this._isAdditive\n );\n animatable.weight = this._weight;\n animatable.onAnimationEnd = () => {\n this.onAnimationEndObservable.notifyObservers(targetedAnimation);\n this._checkAnimationGroupEnded(animatable);\n };\n\n this._processLoop(animatable, targetedAnimation, index);\n this._animatables.push(animatable);\n }\n\n this._speedRatio = speedRatio;\n\n this._isStarted = true;\n this._isPaused = false;\n\n this.onAnimationGroupPlayObservable.notifyObservers(this);\n\n return this;\n }\n\n /**\n * Pause all animations\n * @returns the animation group\n */\n public pause(): AnimationGroup {\n if (!this._isStarted) {\n return this;\n }\n\n this._isPaused = true;\n\n for (let index = 0; index < this._animatables.length; index++) {\n const animatable = this._animatables[index];\n animatable.pause();\n }\n\n this.onAnimationGroupPauseObservable.notifyObservers(this);\n\n return this;\n }\n\n /**\n * Play all animations to initial state\n * This function will start() the animations if they were not started or will restart() them if they were paused\n * @param loop defines if animations must loop\n * @returns the animation group\n */\n public play(loop?: boolean): AnimationGroup {\n // only if all animatables are ready and exist\n if (this.isStarted && this._animatables.length === this._targetedAnimations.length) {\n if (loop !== undefined) {\n this.loopAnimation = loop;\n }\n this.restart();\n } else {\n this.stop();\n this.start(loop, this._speedRatio);\n }\n\n this._isPaused = false;\n\n return this;\n }\n\n /**\n * Reset all animations to initial state\n * @returns the animation group\n */\n public reset(): AnimationGroup {\n if (!this._isStarted) {\n this.play();\n this.goToFrame(0);\n this.stop();\n return this;\n }\n\n for (let index = 0; index < this._animatables.length; index++) {\n const animatable = this._animatables[index];\n animatable.reset();\n }\n\n return this;\n }\n\n /**\n * Restart animations from key 0\n * @returns the animation group\n */\n public restart(): AnimationGroup {\n if (!this._isStarted) {\n return this;\n }\n\n for (let index = 0; index < this._animatables.length; index++) {\n const animatable = this._animatables[index];\n animatable.restart();\n }\n\n this.onAnimationGroupPlayObservable.notifyObservers(this);\n\n return this;\n }\n\n /**\n * Stop all animations\n * @returns the animation group\n */\n public stop(): AnimationGroup {\n if (!this._isStarted) {\n return this;\n }\n\n const list = this._animatables.slice();\n for (let index = 0; index < list.length; index++) {\n list[index].stop(undefined, undefined, true);\n }\n\n // We will take care of removing all stopped animatables\n let curIndex = 0;\n for (let index = 0; index < this._scene._activeAnimatables.length; index++) {\n const animatable = this._scene._activeAnimatables[index];\n if (animatable._runtimeAnimations.length > 0) {\n this._scene._activeAnimatables[curIndex++] = animatable;\n }\n }\n this._scene._activeAnimatables.length = curIndex;\n\n this._isStarted = false;\n\n return this;\n }\n\n /**\n * Set animation weight for all animatables\n *\n * @since 6.12.4\n * You can pass the weight to the AnimationGroup constructor, or use the weight property to set it after the group has been created,\n * making it easier to define the overall animation weight than calling setWeightForAllAnimatables() after the animation group has been started\n * @param weight defines the weight to use\n * @returns the animationGroup\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#animation-weights\n */\n public setWeightForAllAnimatables(weight: number): AnimationGroup {\n for (let index = 0; index < this._animatables.length; index++) {\n const animatable = this._animatables[index];\n animatable.weight = weight;\n }\n\n return this;\n }\n\n /**\n * Synchronize and normalize all animatables with a source animatable\n * @param root defines the root animatable to synchronize with (null to stop synchronizing)\n * @returns the animationGroup\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#animation-weights\n */\n public syncAllAnimationsWith(root: Nullable<Animatable>): AnimationGroup {\n for (let index = 0; index < this._animatables.length; index++) {\n const animatable = this._animatables[index];\n animatable.syncWith(root);\n }\n\n return this;\n }\n\n /**\n * Goes to a specific frame in this animation group\n * @param frame the frame number to go to\n * @returns the animationGroup\n */\n public goToFrame(frame: number): AnimationGroup {\n if (!this._isStarted) {\n return this;\n }\n\n for (let index = 0; index < this._animatables.length; index++) {\n const animatable = this._animatables[index];\n animatable.goToFrame(frame);\n }\n\n return this;\n }\n\n /**\n * Dispose all associated resources\n */\n public dispose(): void {\n this._targetedAnimations.length = 0;\n this._animatables.length = 0;\n\n // Remove from scene\n const index = this._scene.animationGroups.indexOf(this);\n\n if (index > -1) {\n this._scene.animationGroups.splice(index, 1);\n }\n\n if (this._parentContainer) {\n const index = this._parentContainer.animationGroups.indexOf(this);\n if (index > -1) {\n this._parentContainer.animationGroups.splice(index, 1);\n }\n this._parentContainer = null;\n }\n\n this.onAnimationEndObservable.clear();\n this.onAnimationGroupEndObservable.clear();\n this.onAnimationGroupPauseObservable.clear();\n this.onAnimationGroupPlayObservable.clear();\n this.onAnimationLoopObservable.clear();\n this.onAnimationGroupLoopObservable.clear();\n }\n\n private _checkAnimationGroupEnded(animatable: Animatable) {\n // animatable should be taken out of the array\n const idx = this._animatables.indexOf(animatable);\n if (idx > -1) {\n this._animatables.splice(idx, 1);\n }\n\n // all animatables were removed? animation group ended!\n if (this._animatables.length === 0) {\n this._isStarted = false;\n this.onAnimationGroupEndObservable.notifyObservers(this);\n }\n }\n\n /**\n * Clone the current animation group and returns a copy\n * @param newName defines the name of the new group\n * @param targetConverter defines an optional function used to convert current animation targets to new ones\n * @param cloneAnimations defines if the animations should be cloned or referenced\n * @returns the new animation group\n */\n public clone(newName: string, targetConverter?: (oldTarget: any) => any, cloneAnimations = false): AnimationGroup {\n const newGroup = new AnimationGroup(newName || this.name, this._scene);\n\n for (const targetAnimation of this._targetedAnimations) {\n newGroup.addTargetedAnimation(\n cloneAnimations ? targetAnimation.animation.clone() : targetAnimation.animation,\n targetConverter ? targetConverter(targetAnimation.target) : targetAnimation.target\n );\n }\n\n return newGroup;\n }\n\n /**\n * Serializes the animationGroup to an object\n * @returns Serialized object\n */\n public serialize(): any {\n const serializationObject: any = {};\n\n serializationObject.name = this.name;\n serializationObject.from = this.from;\n serializationObject.to = this.to;\n serializationObject.targetedAnimations = [];\n for (let targetedAnimationIndex = 0; targetedAnimationIndex < this.targetedAnimations.length; targetedAnimationIndex++) {\n const targetedAnimation = this.targetedAnimations[targetedAnimationIndex];\n serializationObject.targetedAnimations[targetedAnimationIndex] = targetedAnimation.serialize();\n }\n\n if (Tags && Tags.HasTags(this)) {\n serializationObject.tags = Tags.GetTags(this);\n }\n\n // Metadata\n if (this.metadata) {\n serializationObject.metadata = this.metadata;\n }\n\n return serializationObject;\n }\n\n // Statics\n /**\n * Returns a new AnimationGroup object parsed from the source provided.\n * @param parsedAnimationGroup defines the source\n * @param scene defines the scene that will receive the animationGroup\n * @returns a new AnimationGroup\n */\n public static Parse(parsedAnimationGroup: any, scene: Scene): AnimationGroup {\n const animationGroup = new AnimationGroup(parsedAnimationGroup.name, scene);\n for (let i = 0; i < parsedAnimationGroup.targetedAnimations.length; i++) {\n const targetedAnimation = parsedAnimationGroup.targetedAnimations[i];\n const animation = Animation.Parse(targetedAnimation.animation);\n const id = targetedAnimation.targetId;\n if (targetedAnimation.animation.property === \"influence\") {\n // morph target animation\n const morphTarget = scene.getMorphTargetById(id);\n if (morphTarget) {\n animationGroup.addTargetedAnimation(animation, morphTarget);\n }\n } else {\n const targetNode = scene.getNodeById(id);\n\n if (targetNode != null) {\n animationGroup.addTargetedAnimation(animation, targetNode);\n }\n }\n }\n\n if (parsedAnimationGroup.from !== null && parsedAnimationGroup.to !== null) {\n animationGroup.normalize(parsedAnimationGroup.from, parsedAnimationGroup.to);\n }\n\n if (Tags) {\n Tags.AddTagsTo(animationGroup, parsedAnimationGroup.tags);\n }\n\n if (parsedAnimationGroup.metadata !== undefined) {\n animationGroup.metadata = parsedAnimationGroup.metadata;\n }\n\n return animationGroup;\n }\n\n /**\n * Convert the keyframes for all animations belonging to the group to be relative to a given reference frame.\n * @param sourceAnimationGroup defines the AnimationGroup containing animations to convert\n * @param referenceFrame defines the frame that keyframes in the range will be relative to\n * @param range defines the name of the AnimationRange belonging to the animations in the group to convert\n * @param cloneOriginal defines whether or not to clone the group and convert the clone or convert the original group (default is false)\n * @param clonedName defines the name of the resulting cloned AnimationGroup if cloneOriginal is true\n * @returns a new AnimationGroup if cloneOriginal is true or the original AnimationGroup if cloneOriginal is false\n */\n public static MakeAnimationAdditive(sourceAnimationGroup: AnimationGroup, referenceFrame = 0, range?: string, cloneOriginal = false, clonedName?: string): AnimationGroup {\n let animationGroup = sourceAnimationGroup;\n if (cloneOriginal) {\n animationGroup = sourceAnimationGroup.clone(clonedName || animationGroup.name);\n }\n\n const targetedAnimations = animationGroup.targetedAnimations;\n for (let index = 0; index < targetedAnimations.length; index++) {\n const targetedAnimation = targetedAnimations[index];\n Animation.MakeAnimationAdditive(targetedAnimation.animation, referenceFrame, range);\n }\n\n animationGroup.isAdditive = true;\n\n return animationGroup;\n }\n\n /**\n * Returns the string \"AnimationGroup\"\n * @returns \"AnimationGroup\"\n */\n public getClassName(): string {\n return \"AnimationGroup\";\n }\n\n /**\n * Creates a detailed string about the object\n * @param fullDetails defines if the output string will support multiple levels of logging within scene loading\n * @returns a string representing the object\n */\n public toString(fullDetails?: boolean): string {\n let ret = \"Name: \" + this.name;\n ret += \", type: \" + this.getClassName();\n if (fullDetails) {\n ret += \", from: \" + this._from;\n ret += \", to: \" + this._to;\n ret += \", isStarted: \" + this._isStarted;\n ret += \", speedRatio: \" + this._speedRatio;\n ret += \", targetedAnimations length: \" + this._targetedAnimations.length;\n ret += \", animatables length: \" + this._animatables;\n }\n return ret;\n }\n}\n"]}
package/Audio/sound.d.ts CHANGED
@@ -162,6 +162,7 @@ export declare class Sound {
162
162
  */
163
163
  updateOptions(options: ISoundOptions): void;
164
164
  private _createSpatialParameters;
165
+ private _disableSpatialSound;
165
166
  private _updateSpatialParameters;
166
167
  /**
167
168
  * Switch the panning model to HRTF:
package/Audio/sound.js CHANGED
@@ -52,10 +52,20 @@ export class Sound {
52
52
  * @see https://doc.babylonjs.com/features/featuresDeepDive/audio/playingSoundsMusic#creating-a-spatial-3d-sound
53
53
  */
54
54
  set spatialSound(newValue) {
55
- var _a;
56
- this._spatialSound = newValue;
57
- if (this._spatialSound && ((_a = Engine.audioEngine) === null || _a === void 0 ? void 0 : _a.canUseWebAudio) && Engine.audioEngine.audioContext) {
58
- this._createSpatialParameters();
55
+ if (newValue == this._spatialSound) {
56
+ return;
57
+ }
58
+ const wasPlaying = this.isPlaying;
59
+ this.pause();
60
+ if (newValue) {
61
+ this._spatialSound = newValue;
62
+ this._updateSpatialParameters();
63
+ }
64
+ else {
65
+ this._disableSpatialSound();
66
+ }
67
+ if (wasPlaying) {
68
+ this.play();
59
69
  }
60
70
  }
61
71
  /**
@@ -431,7 +441,7 @@ export class Sound {
431
441
  * @param options A JSON object containing values named as the object properties
432
442
  */
433
443
  updateOptions(options) {
434
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
444
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
435
445
  if (options) {
436
446
  this.loop = (_a = options.loop) !== null && _a !== void 0 ? _a : this.loop;
437
447
  this.maxDistance = (_b = options.maxDistance) !== null && _b !== void 0 ? _b : this.maxDistance;
@@ -441,8 +451,9 @@ export class Sound {
441
451
  this.distanceModel = (_f = options.distanceModel) !== null && _f !== void 0 ? _f : this.distanceModel;
442
452
  this._playbackRate = (_g = options.playbackRate) !== null && _g !== void 0 ? _g : this._playbackRate;
443
453
  this._length = (_h = options.length) !== null && _h !== void 0 ? _h : undefined;
444
- this._setOffset((_j = options.offset) !== null && _j !== void 0 ? _j : undefined);
445
- this.setVolume((_k = options.volume) !== null && _k !== void 0 ? _k : this._volume);
454
+ this.spatialSound = (_j = options.spatialSound) !== null && _j !== void 0 ? _j : this._spatialSound;
455
+ this._setOffset((_k = options.offset) !== null && _k !== void 0 ? _k : undefined);
456
+ this.setVolume((_l = options.volume) !== null && _l !== void 0 ? _l : this._volume);
446
457
  this._updateSpatialParameters();
447
458
  if (this.isPlaying) {
448
459
  if (this._streaming && this._htmlAudioElement) {
@@ -482,8 +493,21 @@ export class Sound {
482
493
  }
483
494
  }
484
495
  }
496
+ _disableSpatialSound() {
497
+ var _a;
498
+ if (!this._spatialSound) {
499
+ return;
500
+ }
501
+ this._inputAudioNode = this._soundGain;
502
+ (_a = this._soundPanner) === null || _a === void 0 ? void 0 : _a.disconnect();
503
+ this._soundPanner = null;
504
+ this._spatialSound = false;
505
+ }
485
506
  _updateSpatialParameters() {
486
- if (this._spatialSound && this._soundPanner) {
507
+ if (!this._spatialSound) {
508
+ return;
509
+ }
510
+ if (this._soundPanner) {
487
511
  if (this.useCustomAttenuation) {
488
512
  // Tricks to disable in a way embedded Web Audio attenuation
489
513
  this._soundPanner.distanceModel = "linear";
@@ -500,6 +524,9 @@ export class Sound {
500
524
  this._soundPanner.panningModel = this._panningModel;
501
525
  }
502
526
  }
527
+ else {
528
+ this._createSpatialParameters();
529
+ }
503
530
  }
504
531
  /**
505
532
  * Switch the panning model to HRTF: