UNPKG

@awayjs/graphics

Version:
72 lines (71 loc) 2.35 kB
import { Vector3D } from '@awayjs/core'; /** * */ var AnimationStateBase = /** @class */ (function () { function AnimationStateBase(animator, animationNode) { this._pRootDelta = new Vector3D(); this._pPositionDeltaDirty = true; this._pStartTime = 0; this._pAnimator = animator; this._pAnimationNode = animationNode; } Object.defineProperty(AnimationStateBase.prototype, "positionDelta", { /** * Returns a 3d vector representing the translation delta of the animating entity for the current timestep of animation */ get: function () { if (this._pPositionDeltaDirty) { this._pUpdatePositionDelta(); } return this._pRootDelta; }, enumerable: false, configurable: true }); /** * Resets the start time of the node to a new value. * * @param startTime The absolute start time (in milliseconds) of the node's starting time. */ AnimationStateBase.prototype.offset = function (startTime) { this._pStartTime = startTime; this._pPositionDeltaDirty = true; }; /** * Updates the configuration of the node to its current state. * * @param time The absolute time (in milliseconds) of the animator's play head position. * * @see AnimatorBase#update() */ AnimationStateBase.prototype.update = function (time) { if (this._pTime == time - this._pStartTime) { return; } this._pUpdateTime(time); }; /** * Sets the animation phase of the node. * * @param value The phase value to use. 0 represents the beginning of an animation clip, 1 represents the end. */ AnimationStateBase.prototype.phase = function (value) { }; /** * Updates the node's internal playhead position. * * @param time The local time (in milliseconds) of the node's playhead position. */ AnimationStateBase.prototype._pUpdateTime = function (time) { this._pTime = time - this._pStartTime; this._pPositionDeltaDirty = true; }; /** * Updates the node's root delta position */ AnimationStateBase.prototype._pUpdatePositionDelta = function () { }; return AnimationStateBase; }()); export { AnimationStateBase };