smoothstep static method

num smoothstep(
  1. num x,
  2. num min,
  3. num max
)

Implementation

static num smoothstep(num x, num min, num max) {
  if (x <= min) return 0;
  if (x >= max) return 1;

  x = (x - min) / (max - min);

  return x * x * (3 - 2 * x);
}