transformInternal method

  1. @override
double transformInternal(
  1. double t
)
override

Override this method to define the curve's behavior.

t is guaranteed to be in the range (0.0, 1.0) exclusive.

Implementation

@override
double transformInternal(double t) {
  double start = 0.0;
  double end = 1.0;
  while (true) {
    final midpoint = (start + end) / 2;
    final estimate = _evaluateCubic(a, c, midpoint);
    if ((t - estimate).abs() < _cubicErrorBound) {
      return _evaluateCubic(b, d, midpoint);
    }
    if (estimate < t) {
      start = midpoint;
    } else {
      end = midpoint;
    }
  }
}