|
@@ -22,8 +22,8 @@ function AnimationAction( mixer, clip, localRoot ) {
|
|
|
interpolants = new Array( nTracks );
|
|
|
|
|
|
var interpolantSettings = {
|
|
|
- endingStart: ZeroCurvatureEnding,
|
|
|
- endingEnd: ZeroCurvatureEnding
|
|
|
+ endingStart: ZeroCurvatureEnding,
|
|
|
+ endingEnd: ZeroCurvatureEnding
|
|
|
};
|
|
|
|
|
|
for ( var i = 0; i !== nTracks; ++ i ) {
|
|
@@ -48,7 +48,7 @@ function AnimationAction( mixer, clip, localRoot ) {
|
|
|
this._weightInterpolant = null;
|
|
|
|
|
|
this.loop = LoopRepeat;
|
|
|
- this._loopCount = -1;
|
|
|
+ this._loopCount = - 1;
|
|
|
|
|
|
// global mixer time when the action is to be started
|
|
|
// it's set back to 'null' upon start of the action
|
|
@@ -80,7 +80,7 @@ Object.assign( AnimationAction.prototype, {
|
|
|
|
|
|
// State & Scheduling
|
|
|
|
|
|
- play: function() {
|
|
|
+ play: function () {
|
|
|
|
|
|
this._mixer._activateAction( this );
|
|
|
|
|
@@ -88,7 +88,7 @@ Object.assign( AnimationAction.prototype, {
|
|
|
|
|
|
},
|
|
|
|
|
|
- stop: function() {
|
|
|
+ stop: function () {
|
|
|
|
|
|
this._mixer._deactivateAction( this );
|
|
|
|
|
@@ -96,20 +96,20 @@ Object.assign( AnimationAction.prototype, {
|
|
|
|
|
|
},
|
|
|
|
|
|
- reset: function() {
|
|
|
+ reset: function () {
|
|
|
|
|
|
this.paused = false;
|
|
|
this.enabled = true;
|
|
|
|
|
|
this.time = 0; // restart clip
|
|
|
- this._loopCount = -1; // forget previous loops
|
|
|
+ this._loopCount = - 1; // forget previous loops
|
|
|
this._startTime = null; // forget scheduling
|
|
|
|
|
|
return this.stopFading().stopWarping();
|
|
|
|
|
|
},
|
|
|
|
|
|
- isRunning: function() {
|
|
|
+ isRunning: function () {
|
|
|
|
|
|
return this.enabled && ! this.paused && this.timeScale !== 0 &&
|
|
|
this._startTime === null && this._mixer._isActiveAction( this );
|
|
@@ -117,13 +117,13 @@ Object.assign( AnimationAction.prototype, {
|
|
|
},
|
|
|
|
|
|
// return true when play has been called
|
|
|
- isScheduled: function() {
|
|
|
+ isScheduled: function () {
|
|
|
|
|
|
return this._mixer._isActiveAction( this );
|
|
|
|
|
|
},
|
|
|
|
|
|
- startAt: function( time ) {
|
|
|
+ startAt: function ( time ) {
|
|
|
|
|
|
this._startTime = time;
|
|
|
|
|
@@ -131,7 +131,7 @@ Object.assign( AnimationAction.prototype, {
|
|
|
|
|
|
},
|
|
|
|
|
|
- setLoop: function( mode, repetitions ) {
|
|
|
+ setLoop: function ( mode, repetitions ) {
|
|
|
|
|
|
this.loop = mode;
|
|
|
this.repetitions = repetitions;
|
|
@@ -145,7 +145,7 @@ Object.assign( AnimationAction.prototype, {
|
|
|
// set the weight stopping any scheduled fading
|
|
|
// although .enabled = false yields an effective weight of zero, this
|
|
|
// method does *not* change .enabled, because it would be confusing
|
|
|
- setEffectiveWeight: function( weight ) {
|
|
|
+ setEffectiveWeight: function ( weight ) {
|
|
|
|
|
|
this.weight = weight;
|
|
|
|
|
@@ -157,30 +157,30 @@ Object.assign( AnimationAction.prototype, {
|
|
|
},
|
|
|
|
|
|
// return the weight considering fading and .enabled
|
|
|
- getEffectiveWeight: function() {
|
|
|
+ getEffectiveWeight: function () {
|
|
|
|
|
|
return this._effectiveWeight;
|
|
|
|
|
|
},
|
|
|
|
|
|
- fadeIn: function( duration ) {
|
|
|
+ fadeIn: function ( duration ) {
|
|
|
|
|
|
return this._scheduleFading( duration, 0, 1 );
|
|
|
|
|
|
},
|
|
|
|
|
|
- fadeOut: function( duration ) {
|
|
|
+ fadeOut: function ( duration ) {
|
|
|
|
|
|
return this._scheduleFading( duration, 1, 0 );
|
|
|
|
|
|
},
|
|
|
|
|
|
- crossFadeFrom: function( fadeOutAction, duration, warp ) {
|
|
|
+ crossFadeFrom: function ( fadeOutAction, duration, warp ) {
|
|
|
|
|
|
fadeOutAction.fadeOut( duration );
|
|
|
this.fadeIn( duration );
|
|
|
|
|
|
- if( warp ) {
|
|
|
+ if ( warp ) {
|
|
|
|
|
|
var fadeInDuration = this._clip.duration,
|
|
|
fadeOutDuration = fadeOutAction._clip.duration,
|
|
@@ -197,13 +197,13 @@ Object.assign( AnimationAction.prototype, {
|
|
|
|
|
|
},
|
|
|
|
|
|
- crossFadeTo: function( fadeInAction, duration, warp ) {
|
|
|
+ crossFadeTo: function ( fadeInAction, duration, warp ) {
|
|
|
|
|
|
return fadeInAction.crossFadeFrom( this, duration, warp );
|
|
|
|
|
|
},
|
|
|
|
|
|
- stopFading: function() {
|
|
|
+ stopFading: function () {
|
|
|
|
|
|
var weightInterpolant = this._weightInterpolant;
|
|
|
|
|
@@ -223,23 +223,23 @@ Object.assign( AnimationAction.prototype, {
|
|
|
// set the time scale stopping any scheduled warping
|
|
|
// although .paused = true yields an effective time scale of zero, this
|
|
|
// method does *not* change .paused, because it would be confusing
|
|
|
- setEffectiveTimeScale: function( timeScale ) {
|
|
|
+ setEffectiveTimeScale: function ( timeScale ) {
|
|
|
|
|
|
this.timeScale = timeScale;
|
|
|
- this._effectiveTimeScale = this.paused ? 0 :timeScale;
|
|
|
+ this._effectiveTimeScale = this.paused ? 0 : timeScale;
|
|
|
|
|
|
return this.stopWarping();
|
|
|
|
|
|
},
|
|
|
|
|
|
// return the time scale considering warping and .paused
|
|
|
- getEffectiveTimeScale: function() {
|
|
|
+ getEffectiveTimeScale: function () {
|
|
|
|
|
|
return this._effectiveTimeScale;
|
|
|
|
|
|
},
|
|
|
|
|
|
- setDuration: function( duration ) {
|
|
|
+ setDuration: function ( duration ) {
|
|
|
|
|
|
this.timeScale = this._clip.duration / duration;
|
|
|
|
|
@@ -247,7 +247,7 @@ Object.assign( AnimationAction.prototype, {
|
|
|
|
|
|
},
|
|
|
|
|
|
- syncWith: function( action ) {
|
|
|
+ syncWith: function ( action ) {
|
|
|
|
|
|
this.time = action.time;
|
|
|
this.timeScale = action.timeScale;
|
|
@@ -256,13 +256,13 @@ Object.assign( AnimationAction.prototype, {
|
|
|
|
|
|
},
|
|
|
|
|
|
- halt: function( duration ) {
|
|
|
+ halt: function ( duration ) {
|
|
|
|
|
|
return this.warp( this._effectiveTimeScale, 0, duration );
|
|
|
|
|
|
},
|
|
|
|
|
|
- warp: function( startTimeScale, endTimeScale, duration ) {
|
|
|
+ warp: function ( startTimeScale, endTimeScale, duration ) {
|
|
|
|
|
|
var mixer = this._mixer, now = mixer.time,
|
|
|
interpolant = this._timeScaleInterpolant,
|
|
@@ -289,7 +289,7 @@ Object.assign( AnimationAction.prototype, {
|
|
|
|
|
|
},
|
|
|
|
|
|
- stopWarping: function() {
|
|
|
+ stopWarping: function () {
|
|
|
|
|
|
var timeScaleInterpolant = this._timeScaleInterpolant;
|
|
|
|
|
@@ -306,19 +306,19 @@ Object.assign( AnimationAction.prototype, {
|
|
|
|
|
|
// Object Accessors
|
|
|
|
|
|
- getMixer: function() {
|
|
|
+ getMixer: function () {
|
|
|
|
|
|
return this._mixer;
|
|
|
|
|
|
},
|
|
|
|
|
|
- getClip: function() {
|
|
|
+ getClip: function () {
|
|
|
|
|
|
return this._clip;
|
|
|
|
|
|
},
|
|
|
|
|
|
- getRoot: function() {
|
|
|
+ getRoot: function () {
|
|
|
|
|
|
return this._localRoot || this._mixer._root;
|
|
|
|
|
@@ -326,7 +326,7 @@ Object.assign( AnimationAction.prototype, {
|
|
|
|
|
|
// Interna
|
|
|
|
|
|
- _update: function( time, deltaTime, timeDirection, accuIndex ) {
|
|
|
+ _update: function ( time, deltaTime, timeDirection, accuIndex ) {
|
|
|
|
|
|
// called by the mixer
|
|
|
|
|
@@ -385,7 +385,7 @@ Object.assign( AnimationAction.prototype, {
|
|
|
|
|
|
},
|
|
|
|
|
|
- _updateWeight: function( time ) {
|
|
|
+ _updateWeight: function ( time ) {
|
|
|
|
|
|
var weight = 0;
|
|
|
|
|
@@ -422,7 +422,7 @@ Object.assign( AnimationAction.prototype, {
|
|
|
|
|
|
},
|
|
|
|
|
|
- _updateTimeScale: function( time ) {
|
|
|
+ _updateTimeScale: function ( time ) {
|
|
|
|
|
|
var timeScale = 0;
|
|
|
|
|
@@ -465,7 +465,7 @@ Object.assign( AnimationAction.prototype, {
|
|
|
|
|
|
},
|
|
|
|
|
|
- _updateTime: function( deltaTime ) {
|
|
|
+ _updateTime: function ( deltaTime ) {
|
|
|
|
|
|
var time = this.time + deltaTime;
|
|
|
|
|
@@ -478,7 +478,7 @@ Object.assign( AnimationAction.prototype, {
|
|
|
|
|
|
if ( loop === LoopOnce ) {
|
|
|
|
|
|
- if ( loopCount === -1 ) {
|
|
|
+ if ( loopCount === - 1 ) {
|
|
|
// just started
|
|
|
|
|
|
this._loopCount = 0;
|
|
@@ -503,7 +503,7 @@ Object.assign( AnimationAction.prototype, {
|
|
|
|
|
|
this._mixer.dispatchEvent( {
|
|
|
type: 'finished', action: this,
|
|
|
- direction: deltaTime < 0 ? -1 : 1
|
|
|
+ direction: deltaTime < 0 ? - 1 : 1
|
|
|
} );
|
|
|
|
|
|
}
|
|
@@ -512,15 +512,14 @@ Object.assign( AnimationAction.prototype, {
|
|
|
|
|
|
var pingPong = ( loop === LoopPingPong );
|
|
|
|
|
|
- if ( loopCount === -1 ) {
|
|
|
+ if ( loopCount === - 1 ) {
|
|
|
// just started
|
|
|
|
|
|
if ( deltaTime >= 0 ) {
|
|
|
|
|
|
loopCount = 0;
|
|
|
|
|
|
- this._setEndings(
|
|
|
- true, this.repetitions === 0, pingPong );
|
|
|
+ this._setEndings( true, this.repetitions === 0, pingPong );
|
|
|
|
|
|
} else {
|
|
|
|
|
@@ -528,8 +527,7 @@ Object.assign( AnimationAction.prototype, {
|
|
|
// transition through zero counts as a repetition,
|
|
|
// so leave loopCount at -1
|
|
|
|
|
|
- this._setEndings(
|
|
|
- this.repetitions === 0, true, pingPong );
|
|
|
+ this._setEndings( this.repetitions === 0, true, pingPong );
|
|
|
|
|
|
}
|
|
|
|
|
@@ -598,7 +596,7 @@ Object.assign( AnimationAction.prototype, {
|
|
|
|
|
|
},
|
|
|
|
|
|
- _setEndings: function( atStart, atEnd, pingPong ) {
|
|
|
+ _setEndings: function ( atStart, atEnd, pingPong ) {
|
|
|
|
|
|
var settings = this._interpolantSettings;
|
|
|
|
|
@@ -613,8 +611,7 @@ Object.assign( AnimationAction.prototype, {
|
|
|
|
|
|
if ( atStart ) {
|
|
|
|
|
|
- settings.endingStart = this.zeroSlopeAtStart ?
|
|
|
- ZeroSlopeEnding : ZeroCurvatureEnding;
|
|
|
+ settings.endingStart = this.zeroSlopeAtStart ? ZeroSlopeEnding : ZeroCurvatureEnding;
|
|
|
|
|
|
} else {
|
|
|
|
|
@@ -624,8 +621,7 @@ Object.assign( AnimationAction.prototype, {
|
|
|
|
|
|
if ( atEnd ) {
|
|
|
|
|
|
- settings.endingEnd = this.zeroSlopeAtEnd ?
|
|
|
- ZeroSlopeEnding : ZeroCurvatureEnding;
|
|
|
+ settings.endingEnd = this.zeroSlopeAtEnd ? ZeroSlopeEnding : ZeroCurvatureEnding;
|
|
|
|
|
|
} else {
|
|
|
|
|
@@ -637,7 +633,7 @@ Object.assign( AnimationAction.prototype, {
|
|
|
|
|
|
},
|
|
|
|
|
|
- _scheduleFading: function( duration, weightNow, weightThen ) {
|
|
|
+ _scheduleFading: function ( duration, weightNow, weightThen ) {
|
|
|
|
|
|
var mixer = this._mixer, now = mixer.time,
|
|
|
interpolant = this._weightInterpolant;
|