smoothStep function

double smoothStep (double edge0, double edge1, double amount)

Do a smooth step (hermite interpolation) interpolation with edge0 and edge1 by amount. The computation is equivalent to the GLSL function smoothstep.

Implementation

double smoothStep(double edge0, double edge1, double amount) {
  final double t =
      ((amount - edge0) / (edge1 - edge0)).clamp(0.0, 1.0).toDouble();

  return t * t * (3.0 - 2.0 * t);
}