lerp static method

Implementation

static LightSource? lerp(LightSource? a, LightSource? b, double t) {
  if (a == null && b == null) return null;
  if (a == null) return b;
  if (b == null) return a;
  if (a == b) return a;
  if (t == 0.0) return a;
  if (t == 1.0) return b;

  return LightSource(
    (a.dx != b.dx ? lerpDouble(a.dx, b.dx, t) : a.dx)!,
    (a.dy != b.dy ? lerpDouble(a.dy, b.dy, t) : a.dy)!,
  );
}