|
@@ -51475,7 +51475,28 @@ var BABYLON;
|
|
|
* Class used to store an actual running animation
|
|
|
*/
|
|
|
var Animatable = /** @class */ (function () {
|
|
|
- function Animatable(scene, target, fromFrame, toFrame, loopAnimation, speedRatio, onAnimationEnd, animations) {
|
|
|
+ /**
|
|
|
+ * Creates a new Animatable
|
|
|
+ * @param scene defines the hosting scene
|
|
|
+ * @param target defines the target object
|
|
|
+ * @param fromFrame defines the starting frame number (default is 0)
|
|
|
+ * @param toFrame defines the ending frame number (default is 100)
|
|
|
+ * @param loopAnimation defines if the animation must loop (default is false)
|
|
|
+ * @param speedRatio defines the factor to apply to animation speed (default is 1)
|
|
|
+ * @param onAnimationEnd defines a callback to call when animation ends if it is not looping
|
|
|
+ * @param animations defines a group of animation to add to the new Animatable
|
|
|
+ */
|
|
|
+ function Animatable(scene,
|
|
|
+ /** defines the target object */
|
|
|
+ target,
|
|
|
+ /** defines the starting frame number (default is 0) */
|
|
|
+ fromFrame,
|
|
|
+ /** defines the ending frame number (default is 100) */
|
|
|
+ toFrame,
|
|
|
+ /** defines if the animation must loop (default is false) */
|
|
|
+ loopAnimation, speedRatio,
|
|
|
+ /** defines a callback to call when animation ends if it is not looping */
|
|
|
+ onAnimationEnd, animations) {
|
|
|
if (fromFrame === void 0) { fromFrame = 0; }
|
|
|
if (toFrame === void 0) { toFrame = 100; }
|
|
|
if (loopAnimation === void 0) { loopAnimation = false; }
|
|
@@ -51589,15 +51610,29 @@ var BABYLON;
|
|
|
}
|
|
|
return this;
|
|
|
};
|
|
|
+ /**
|
|
|
+ * Gets the list of runtime animations
|
|
|
+ * @returns an array of RuntimeAnimation
|
|
|
+ */
|
|
|
Animatable.prototype.getAnimations = function () {
|
|
|
return this._runtimeAnimations;
|
|
|
};
|
|
|
+ /**
|
|
|
+ * Adds more animations to the current animatable
|
|
|
+ * @param target defines the target of the animations
|
|
|
+ * @param animations defines the new animations to add
|
|
|
+ */
|
|
|
Animatable.prototype.appendAnimations = function (target, animations) {
|
|
|
for (var index = 0; index < animations.length; index++) {
|
|
|
var animation = animations[index];
|
|
|
this._runtimeAnimations.push(new BABYLON.RuntimeAnimation(target, animation, this._scene, this));
|
|
|
}
|
|
|
};
|
|
|
+ /**
|
|
|
+ * Gets the source animation for a specific property
|
|
|
+ * @param property defines the propertyu to look for
|
|
|
+ * @returns null or the source animation for the given property
|
|
|
+ */
|
|
|
Animatable.prototype.getAnimationByTargetProperty = function (property) {
|
|
|
var runtimeAnimations = this._runtimeAnimations;
|
|
|
for (var index = 0; index < runtimeAnimations.length; index++) {
|
|
@@ -51607,6 +51642,11 @@ var BABYLON;
|
|
|
}
|
|
|
return null;
|
|
|
};
|
|
|
+ /**
|
|
|
+ * Gets the runtime animation for a specific property
|
|
|
+ * @param property defines the propertyu to look for
|
|
|
+ * @returns null or the runtime animation for the given property
|
|
|
+ */
|
|
|
Animatable.prototype.getRuntimeAnimationByTargetProperty = function (property) {
|
|
|
var runtimeAnimations = this._runtimeAnimations;
|
|
|
for (var index = 0; index < runtimeAnimations.length; index++) {
|
|
@@ -51616,6 +51656,9 @@ var BABYLON;
|
|
|
}
|
|
|
return null;
|
|
|
};
|
|
|
+ /**
|
|
|
+ * Resets the animatable to its original state
|
|
|
+ */
|
|
|
Animatable.prototype.reset = function () {
|
|
|
var runtimeAnimations = this._runtimeAnimations;
|
|
|
for (var index = 0; index < runtimeAnimations.length; index++) {
|
|
@@ -51624,6 +51667,11 @@ var BABYLON;
|
|
|
this._localDelayOffset = null;
|
|
|
this._pausedDelay = null;
|
|
|
};
|
|
|
+ /**
|
|
|
+ * Allows the animatable to blend with current running animations
|
|
|
+ * @see http://doc.babylonjs.com/babylon101/animations#animation-blending
|
|
|
+ * @param blendingSpeed defines the blending speed to use
|
|
|
+ */
|
|
|
Animatable.prototype.enableBlending = function (blendingSpeed) {
|
|
|
var runtimeAnimations = this._runtimeAnimations;
|
|
|
for (var index = 0; index < runtimeAnimations.length; index++) {
|
|
@@ -51631,12 +51679,20 @@ var BABYLON;
|
|
|
runtimeAnimations[index].animation.blendingSpeed = blendingSpeed;
|
|
|
}
|
|
|
};
|
|
|
+ /**
|
|
|
+ * Disable animation blending
|
|
|
+ * @see http://doc.babylonjs.com/babylon101/animations#animation-blending
|
|
|
+ */
|
|
|
Animatable.prototype.disableBlending = function () {
|
|
|
var runtimeAnimations = this._runtimeAnimations;
|
|
|
for (var index = 0; index < runtimeAnimations.length; index++) {
|
|
|
runtimeAnimations[index].animation.enableBlending = false;
|
|
|
}
|
|
|
};
|
|
|
+ /**
|
|
|
+ * Jump directly to a given frame
|
|
|
+ * @param frame defines the frame to jump to
|
|
|
+ */
|
|
|
Animatable.prototype.goToFrame = function (frame) {
|
|
|
var runtimeAnimations = this._runtimeAnimations;
|
|
|
if (runtimeAnimations[0]) {
|
|
@@ -51653,12 +51709,18 @@ var BABYLON;
|
|
|
runtimeAnimations[index].goToFrame(frame);
|
|
|
}
|
|
|
};
|
|
|
+ /**
|
|
|
+ * Pause the animation
|
|
|
+ */
|
|
|
Animatable.prototype.pause = function () {
|
|
|
if (this._paused) {
|
|
|
return;
|
|
|
}
|
|
|
this._paused = true;
|
|
|
};
|
|
|
+ /**
|
|
|
+ * Restart the animation
|
|
|
+ */
|
|
|
Animatable.prototype.restart = function () {
|
|
|
this._paused = false;
|
|
|
};
|
|
@@ -51668,6 +51730,10 @@ var BABYLON;
|
|
|
}
|
|
|
this.onAnimationEndObservable.notifyObservers(this);
|
|
|
};
|
|
|
+ /**
|
|
|
+ * Stop and delete the current animation
|
|
|
+ * @param animationName defines a string used to only stop some of the runtime animations instead of all
|
|
|
+ */
|
|
|
Animatable.prototype.stop = function (animationName) {
|
|
|
if (animationName) {
|
|
|
var idx = this._scene._activeAnimatables.indexOf(this);
|
|
@@ -103288,6 +103354,7 @@ var BABYLON;
|
|
|
if (gpu === void 0) { gpu = false; }
|
|
|
var result = new ParticleSystemSet();
|
|
|
var rootUrl = BABYLON.ParticleHelper.BaseAssetsUrl + "/textures/";
|
|
|
+ scene = scene || BABYLON.Engine.LastCreatedScene;
|
|
|
for (var _i = 0, _a = data.systems; _i < _a.length; _i++) {
|
|
|
var system = _a[_i];
|
|
|
result.systems.push(gpu ? BABYLON.GPUParticleSystem.Parse(system, scene, rootUrl) : BABYLON.ParticleSystem.Parse(system, scene, rootUrl));
|
|
@@ -103329,20 +103396,24 @@ var BABYLON;
|
|
|
* @returns the ParticleSystemSet created
|
|
|
*/
|
|
|
ParticleHelper.CreateAsync = function (type, scene, gpu) {
|
|
|
- if (scene === void 0) { scene = BABYLON.Engine.LastCreatedScene; }
|
|
|
if (gpu === void 0) { gpu = false; }
|
|
|
+ if (!scene) {
|
|
|
+ scene = BABYLON.Engine.LastCreatedScene;
|
|
|
+ ;
|
|
|
+ }
|
|
|
+ var token = {};
|
|
|
+ scene._addPendingData(token);
|
|
|
return new Promise(function (resolve, reject) {
|
|
|
- if (!scene) {
|
|
|
- scene = BABYLON.Engine.LastCreatedScene;
|
|
|
- ;
|
|
|
- }
|
|
|
if (gpu && !BABYLON.GPUParticleSystem.IsSupported) {
|
|
|
+ scene._removePendingData(token);
|
|
|
return reject("Particle system with GPU is not supported.");
|
|
|
}
|
|
|
BABYLON.Tools.LoadFile(ParticleHelper.BaseAssetsUrl + "/systems/" + type + ".json", function (data, response) {
|
|
|
+ scene._removePendingData(token);
|
|
|
var newData = JSON.parse(data.toString());
|
|
|
return resolve(BABYLON.ParticleSystemSet.Parse(newData, scene, gpu));
|
|
|
}, undefined, undefined, undefined, function (req, exception) {
|
|
|
+ scene._removePendingData(token);
|
|
|
return reject("An error occured while the creation of your particle system. Check if your type '" + type + "' exists.");
|
|
|
});
|
|
|
});
|