@awayjs/graphics
Version:
AwayJS graphics classes
111 lines (110 loc) • 3.8 kB
JavaScript
import { __extends } from "tslib";
import { Vector3D } from '@awayjs/core';
import { AnimationNodeBase } from '@awayjs/renderer';
/**
* Provides an abstract base class for nodes with time-based animation data in an animation blend tree.
*/
var AnimationClipNodeBase = /** @class */ (function (_super) {
__extends(AnimationClipNodeBase, _super);
/**
* Creates a new <code>AnimationClipNodeBase</code> object.
*/
function AnimationClipNodeBase() {
var _this = _super.call(this) || this;
_this._pLooping = true;
_this._pTotalDuration = 0;
_this._pStitchDirty = true;
_this._pStitchFinalFrame = false;
_this._pNumFrames = 0;
_this._pDurations = new Array();
/*uint*/
_this._pTotalDelta = new Vector3D();
_this.fixedFrameRate = true;
return _this;
}
Object.defineProperty(AnimationClipNodeBase.prototype, "looping", {
/**
* Determines whether the contents of the animation node have looping characteristics enabled.
*/
get: function () {
return this._pLooping;
},
set: function (value) {
if (this._pLooping == value)
return;
this._pLooping = value;
this._pStitchDirty = true;
},
enumerable: false,
configurable: true
});
Object.defineProperty(AnimationClipNodeBase.prototype, "stitchFinalFrame", {
/**
* Defines if looping content blends the final frame of animation data with the first (true) or works on the
* assumption that both first and last frames are identical (false). Defaults to false.
*/
get: function () {
return this._pStitchFinalFrame;
},
set: function (value) {
if (this._pStitchFinalFrame == value)
return;
this._pStitchFinalFrame = value;
this._pStitchDirty = true;
},
enumerable: false,
configurable: true
});
Object.defineProperty(AnimationClipNodeBase.prototype, "totalDuration", {
get: function () {
if (this._pStitchDirty)
this._pUpdateStitch();
return this._pTotalDuration;
},
enumerable: false,
configurable: true
});
Object.defineProperty(AnimationClipNodeBase.prototype, "totalDelta", {
get: function () {
if (this._pStitchDirty)
this._pUpdateStitch();
return this._pTotalDelta;
},
enumerable: false,
configurable: true
});
Object.defineProperty(AnimationClipNodeBase.prototype, "lastFrame", {
get: function () {
if (this._pStitchDirty)
this._pUpdateStitch();
return this._pLastFrame;
},
enumerable: false,
configurable: true
});
Object.defineProperty(AnimationClipNodeBase.prototype, "durations", {
/**
* Returns a vector of time values representing the duration (in milliseconds) of each animation frame in the clip.
*/
get: function () {
return this._pDurations;
},
enumerable: false,
configurable: true
});
/**
* Updates the node's final frame stitch state.
*
* @see #stitchFinalFrame
*/
AnimationClipNodeBase.prototype._pUpdateStitch = function () {
this._pStitchDirty = false;
this._pLastFrame = (this._pStitchFinalFrame) ? this._pNumFrames : this._pNumFrames - 1;
this._pTotalDuration = 0;
this._pTotalDelta.x = 0;
this._pTotalDelta.y = 0;
this._pTotalDelta.z = 0;
};
return AnimationClipNodeBase;
}(AnimationNodeBase));
export { AnimationClipNodeBase };