lerp static method

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

Linearly interpolate between two CornerSpec objects.

If either is null, defaults to CornerSpec.ROUNDED. (If both are null, this returns null.)

The radius is acquired by BorderRadiusGeometry.lerp.

For now, the four CornerSpec corners swap values from a to b according to the half-way keyframe along t.

TODO: Find help.

Implementation

static CornerSpec? lerp(CornerSpec? a, CornerSpec? b, double t) {
  if (a == null && b == null) return null;
  a ??= CornerSpec.ROUNDED;
  b ??= CornerSpec.ROUNDED;
  return CornerSpec(
    topLeft: t < 0.5 ? a.topLeft : b.topLeft,
    topRight: t < 0.5 ? a.topRight : b.topRight,
    bottomRight: t < 0.5 ? a.bottomRight : b.bottomRight,
    bottomLeft: t < 0.5 ? a.bottomLeft : b.bottomLeft,
    radius: BorderRadiusGeometry.lerp(a.radius, b.radius, t),
  );
}