lerp static method

Creates a lerped (linearly interpolated) border style between two existing styles.

  • a: The first WxBorderStyle (can be null).
  • b: The second WxBorderStyle (can be null).
  • t: The interpolation factor (0.0 for a, 1.0 for b).

Implementation

static WxBorderStyle? lerp(
  WxBorderStyle? a,
  WxBorderStyle? b,
  double t,
) {
  if (a == null) return b;
  if (b == null) return a;
  final lowestMultiple = a.pattern.length * b.pattern.length;

  return WxBorderStyle(
    [
      for (int i = 0; i < lowestMultiple; i++)
        lerpDouble(
              a.pattern[i % a.pattern.length],
              b.pattern[i % b.pattern.length],
              t,
            ) ??
            0,
    ],
    absolute: t < 0.5 ? a.absolute : b.absolute,
  );
}