angleLerp static method

double angleLerp(
  1. double from,
  2. double to,
  3. double t
)

Implementation

static double angleLerp(double from, double to, double t) {
  var shortestAngle = angleShortestDistance(from, to);

  var result = from + shortestAngle * t;

  //1e-6: the smallest value that is not stringified in scientific notation.
  //Prevent unwanted result [1e-6, -1e-6]
  if (result < 1e-6 && result > -1e-6) return 0;

  return result;
}