B2G/gecko/browser/devtools/tilt/TiltVisualizer.jsm
/**
   * Executes the next step in the arcball reset animation.
   *
   * @param {Number} aDelta
   *                 the current animation frame delta
   */
Executes the next step in the arcball reset animation.
@param {Number} aDelta
the current animation frame delta
Executes the next step in the arcball reset animation . @param { Number } aDelta the current animation frame delta
function TVA__nextResetStep(aDelta)
  {
    aDelta = TiltMath.clamp(aDelta, 1, 100);
    let fNearZero = EPSILON * EPSILON;
    let fInterpLin = ARCBALL_RESET_LINEAR_FACTOR * aDelta;
    let fInterpSph = ARCBALL_RESET_SPHERICAL_FACTOR;
    let fTran = this._resetFinalTranslation;
    let fRot = this._resetFinalRotation;
    let t = vec3.create(fTran);
    let r = quat4.multiply(quat4.inverse(quat4.create(this._currentRot)), fRot);
    vec3.lerp(this._currentTrans, t, fInterpLin);
    quat4.slerp(this._currentRot, r, fInterpSph);
    vec3.scale(this._additionalTrans, fInterpLin);
    vec3.scale(this._additionalRot, fInterpLin);
    this._zoomAmount *= fInterpLin;
    if (vec3.length(vec3.subtract(this._lastRot, fRot, [])) < fNearZero &&
        vec3.length(vec3.subtract(this._deltaRot, fRot, [])) < fNearZero &&
        vec3.length(vec3.subtract(this._currentRot, fRot, [])) < fNearZero &&
        vec3.length(vec3.subtract(this._lastTrans, fTran, [])) < fNearZero &&
        vec3.length(vec3.subtract(this._deltaTrans, fTran, [])) < fNearZero &&
        vec3.length(vec3.subtract(this._currentTrans, fTran, [])) < fNearZero &&
        vec3.length(this._additionalRot) < fNearZero &&
        vec3.length(this._additionalTrans) < fNearZero) {
      this._cancelReset();
    }
    if ("function" === typeof this._onResetStep) {
      this._onResetStep();
    }
  }
function TVA__nextResetStep ( aDelta ) { aDelta = TiltMath . clamp ( aDelta , 1 , 100 ) ; let fNearZero = EPSILON * EPSILON ; let fInterpLin = ARCBALL_RESET_LINEAR_FACTOR * aDelta ; let fInterpSph = ARCBALL_RESET_SPHERICAL_FACTOR ; let fTran = this . _resetFinalTranslation ; let fRot = this . _resetFinalRotation ; let t = vec3 . create ( fTran ) ; let r = quat4 . multiply ( quat4 . inverse ( quat4 . create ( this . _currentRot ) ) , fRot ) ; vec3 . lerp ( this . _currentTrans , t , fInterpLin ) ; quat4 . slerp ( this . _currentRot , r , fInterpSph ) ; vec3 . scale ( this . _additionalTrans , fInterpLin ) ; vec3 . scale ( this . _additionalRot , fInterpLin ) ; this . _zoomAmount *= fInterpLin ; if ( vec3 . length ( vec3 . subtract ( this . _lastRot , fRot , [ ] ) ) < fNearZero && vec3 . length ( vec3 . subtract ( this . _deltaRot , fRot , [ ] ) ) < fNearZero && vec3 . length ( vec3 . subtract ( this . _currentRot , fRot , [ ] ) ) < fNearZero && vec3 . length ( vec3 . subtract ( this . _lastTrans , fTran , [ ] ) ) < fNearZero && vec3 . length ( vec3 . subtract ( this . _deltaTrans , fTran , [ ] ) ) < fNearZero && vec3 . length ( vec3 . subtract ( this . _currentTrans , fTran , [ ] ) ) < fNearZero && vec3 . length ( this . _additionalRot ) < fNearZero && vec3 . length ( this . _additionalTrans ) < fNearZero ) { this . _cancelReset ( ) ; } if ( "function" === typeof this . _onResetStep ) { this . _onResetStep ( ) ; } }
Executes the next step in the arcball reset animation.
Executes the next step in the arcball reset animation .
// a very large animation frame delta (in case of seriously low framerate) // would cause all the interpolations to become highly unstable // reset the rotation quaternion and translation vector // also reset any additional transforms by the keyboard or mouse // clear the loop if the all values are very close to zero