inverseLerp<T extends num> static method

num inverseLerp<T extends num>(
  1. T x,
  2. T y,
  3. T value
)

Implementation

static num inverseLerp<T extends num>(T x, T y, T value) {
  if (x != y) {
    return (value - x) / (y - x);
  } else {
    return 0;
  }
}