@animech-public/playcanvas
Version:
PlayCanvas WebGL game engine
2 lines (1 loc) • 1.01 kB
JavaScript
import{Vec2 as t}from"../../../core/math/vec2.js";class e{constructor(e,i,h,s,n=1){this._state=e,this._parent=i,this._name=h,Array.isArray(s)?(this._point=new t(s[0],s[1]),this._pointLength=this._point.length()):(this._point=s,this._pointLength=s),this._speed=n,this._weightedSpeed=1,this._weight=1,this._animTrack=null}get parent(){return this._parent}get name(){return this._name}get path(){return this._parent?`${this._parent.path}.${this._name}`:this._name}get point(){return this._point}get pointLength(){return this._pointLength}set weight(t){this._weight=t}get weight(){return this._parent?this._parent.weight*this._weight:this._weight}get normalizedWeight(){const t=this._state.totalWeight;return 0===t?0:this.weight/t}get speed(){return this._weightedSpeed*this._speed}get absoluteSpeed(){return Math.abs(this._speed)}set weightedSpeed(t){this._weightedSpeed=t}get weightedSpeed(){return this._weightedSpeed}set animTrack(t){this._animTrack=t}get animTrack(){return this._animTrack}}export{e as AnimNode};