123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- var __extends = this.__extends || function (d, b) {
- for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
- function __() { this.constructor = d; }
- __.prototype = b.prototype;
- d.prototype = new __();
- };
- var BABYLON;
- (function (BABYLON) {
- var InterpolateValueAction = (function (_super) {
- __extends(InterpolateValueAction, _super);
- function InterpolateValueAction(triggerOptions, target, propertyPath, value, duration, condition, stopOtherAnimations) {
- if (duration === void 0) { duration = 1000; }
- _super.call(this, triggerOptions, condition);
- this.propertyPath = propertyPath;
- this.value = value;
- this.duration = duration;
- this.stopOtherAnimations = stopOtherAnimations;
- this._target = target;
- }
- InterpolateValueAction.prototype._prepare = function () {
- this._target = this._getEffectiveTarget(this._target, this.propertyPath);
- this._property = this._getProperty(this.propertyPath);
- };
- InterpolateValueAction.prototype.execute = function () {
- var scene = this._actionManager.getScene();
- var keys = [
- {
- frame: 0,
- value: this._target[this._property]
- }, {
- frame: 100,
- value: this.value
- }
- ];
- var dataType;
- if (typeof this.value === "number") {
- dataType = BABYLON.Animation.ANIMATIONTYPE_FLOAT;
- }
- else if (this.value instanceof BABYLON.Color3) {
- dataType = BABYLON.Animation.ANIMATIONTYPE_COLOR3;
- }
- else if (this.value instanceof BABYLON.Vector3) {
- dataType = BABYLON.Animation.ANIMATIONTYPE_VECTOR3;
- }
- else if (this.value instanceof BABYLON.Matrix) {
- dataType = BABYLON.Animation.ANIMATIONTYPE_MATRIX;
- }
- else if (this.value instanceof BABYLON.Quaternion) {
- dataType = BABYLON.Animation.ANIMATIONTYPE_QUATERNION;
- }
- else {
- BABYLON.Tools.Warn("InterpolateValueAction: Unsupported type (" + typeof this.value + ")");
- return;
- }
- var animation = new BABYLON.Animation("InterpolateValueAction", this._property, 100 * (1000.0 / this.duration), dataType, BABYLON.Animation.ANIMATIONLOOPMODE_CONSTANT);
- animation.setKeys(keys);
- if (this.stopOtherAnimations) {
- scene.stopAnimation(this._target);
- }
- scene.beginDirectAnimation(this._target, [animation], 0, 100);
- };
- return InterpolateValueAction;
- })(BABYLON.Action);
- BABYLON.InterpolateValueAction = InterpolateValueAction;
- })(BABYLON || (BABYLON = {}));
- //# sourceMappingURL=babylon.interpolateValueAction.js.map
|