transform method

  1. @override
double transform (double t)
override

Returns the value of the curve at point t.

The value of t must be between 0.0 and 1.0, inclusive. Subclasses should assert that this is true.

A curve must map t=0.0 to 0.0 and t=1.0 to 1.0.

Implementation

@override
double transform(double t) {
  assert(t >= 0.0 && t <= 1.0);
  assert(begin >= 0.0);
  assert(begin <= 1.0);
  assert(end >= 0.0);
  assert(end <= 1.0);
  assert(end >= begin);
  if (t == 0.0 || t == 1.0)
    return t;
  t = ((t - begin) / (end - begin)).clamp(0.0, 1.0);
  if (t == 0.0 || t == 1.0)
    return t;
  return curve.transform(t);
}