lerp static method

LinearBorderEdge? lerp(
  1. LinearBorderEdge? a,
  2. LinearBorderEdge? b,
  3. double t
)

Linearly interpolates between two LinearBorders.

If both a and b are null then null is returned. If a is null then we interpolate to b varying size from 0.0 to b.size. If b is null then we interpolate from a varying size from a.size to zero. Otherwise both values are interpolated.

Implementation

static LinearBorderEdge? lerp(LinearBorderEdge? a, LinearBorderEdge? b, double t) {
  if (identical(a, b)) {
    return a;
  }

  a ??= LinearBorderEdge(alignment: b!.alignment, size: 0);
  b ??= LinearBorderEdge(alignment: a.alignment, size: 0);

  return LinearBorderEdge(
    size: lerpDouble(a.size, b.size, t)!,
    alignment: lerpDouble(a.alignment, b.alignment, t)!,
  );
}