B2G/gecko/browser/devtools/tilt/TiltGL.jsm
/**
   * Performs a custom interpolation between two matrices.
   * The result is saved in the first operand.
   *
   * @param {Array} aMat
   *                the first matrix
   * @param {Array} aMat2
   *                the second matrix
   * @param {Number} aLerp
   *                 interpolation amount between the two inputs
   * @param {Number} aDamping
   *                 optional, scalar adjusting the interpolation amortization
   * @param {Number} aBalance
   *                 optional, scalar adjusting the interpolation shift ammount
   */
Performs a custom interpolation between two matrices.
The result is saved in the first operand.


Performs a custom interpolation between two matrices . The result is saved in the first operand .
function TGLR_lerp(aMat, aMat2, aLerp, aDamping, aBalance)
  {
    if (aLerp < 0 || aLerp > 1) {
      return;
    }
    let f = Math.pow(1 - Math.pow(aLerp, aDamping || 1), 1 / aBalance || 1);
    for (let i = 0, len = this.projMatrix.length; i < len; i++) {
      aMat[i] = aMat[i] + f * (aMat2[i] - aMat[i]);
    }
  }
function TGLR_lerp ( aMat , aMat2 , aLerp , aDamping , aBalance ) { if ( aLerp < 0 || aLerp > 1 ) { return ; } let f = Math . pow ( 1 - Math . pow ( aLerp , aDamping || 1 ) , 1 / aBalance || 1 ) ; for ( let i = 0 , len = this . projMatrix . length ; i < len ; i ++ ) { aMat [ i ] = aMat [ i ] + f * ( aMat2 [ i ] - aMat [ i ] ) ; } }
Performs a custom interpolation between two matrices.
Performs a custom interpolation between two matrices .
// calculate the interpolation factor based on the damping and step // interpolate each element from the two matrices