lerpMatrix static method

dynamic lerpMatrix(
  1. Matrix4 begin,
  2. Matrix4 end,
  3. double t
)

Implementation

static lerpMatrix(Matrix4 begin, Matrix4 end, double t) {
  Matrix4 newMatrix4;
  if (CSSMatrix.isAffine(begin)) {
    List matrixA = CSSMatrix.decompose2DMatrix(begin);
    List matrixB = CSSMatrix.decompose2DMatrix(end);
    List lerp2D  = CSSMatrix.lerp2DMatrix(matrixA, matrixB, t);
    newMatrix4 = CSSMatrix.compose2DMatrix(lerp2D);
  } else {
    List beginMatrix = CSSMatrix.decompose3DMatrix(begin)!;
    List endMatrix = CSSMatrix.decompose3DMatrix(end)!;
    List beginQuaternion = beginMatrix[4];
    List endQuaternion = endMatrix[4];
    List<double> quaternion = CSSMatrix.lerpQuaternion(beginQuaternion, endQuaternion, t);
    newMatrix4 = CSSMatrix.compose3DMatrix(
      _lerpFloat64List(beginMatrix[0], endMatrix[0], t),
      _lerpFloat64List(beginMatrix[1], endMatrix[1], t),
      _lerpFloat64List(beginMatrix[2], endMatrix[2], t),
      _lerpFloat64List(beginMatrix[3], endMatrix[3], t),
      quaternion
    );
  }
  return newMatrix4;
}