lerp method

  1. @protected
double lerp(
  1. num x,
  2. num x1,
  3. num x2,
  4. num y1,
  5. num y2,
)

Linear interpolate x between two points (x1, y1) and (x2, y2).

Implementation

@protected
double lerp(num x, num x1, num x2, num y1, num y2) {
  var m = (y2 - y1)/(x2 - x1);
  var y = y1 + (x - x1) * m;
  return y.toDouble();
}