lerp static method

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

Linearly interpolate between two gradient shadows.

The arguments must not be null.

Implementation

static BoxShadow? lerp(BoxShadow? a, BoxShadow? b, double t) {
  if (identical(a, b)) {
    return a;
  }
  if (a == null) return b!.scale(t);
  if (b == null) return a.scale(1.0 - t);

  if (a is GradientShadow && b is GradientShadow) {
    return GradientShadow(
      color: Color.lerp(a.color, b.color, t)!,
      gradient: Gradient.lerp(a.gradient, b.gradient, t)!,
      offset: Offset.lerp(a.offset, b.offset, t)!,
      blurRadius: ui.lerpDouble(a.blurRadius, b.blurRadius, t)!,
      spreadRadius: ui.lerpDouble(a.spreadRadius, b.spreadRadius, t)!,
      blurStyle: a.blurStyle == BlurStyle.normal ? b.blurStyle : a.blurStyle,
    );
  }
  return BoxShadow.lerp(a, b, t);
}