RelativeRect lerp(RelativeRect a, RelativeRect b, double t)

Linearly interpolate between two RelativeRects.

If either rect is null, this function interpolates from RelativeRect.fill.

Source

static RelativeRect lerp(RelativeRect a, RelativeRect b, double t) {
  if (a == null && b == null)
    return null;
  if (a == null)
    return new RelativeRect.fromLTRB(b.left * t, b.top * t, b.right * t, b.bottom * t);
  if (b == null) {
    double k = 1.0 - t;
    return new RelativeRect.fromLTRB(b.left * k, b.top * k, b.right * k, b.bottom * k);
  }
  return new RelativeRect.fromLTRB(
    lerpDouble(a.left, b.left, t),
    lerpDouble(a.top, b.top, t),
    lerpDouble(a.right, b.right, t),
    lerpDouble(a.bottom, b.bottom, t)
  );
}