FlutterLogoDecoration lerp(FlutterLogoDecoration a, FlutterLogoDecoration b, double t)

Linearly interpolate between two Flutter logo descriptions.

Interpolates both the color and the style in a continuous fashion.

See also Decoration.lerp.

Source

static FlutterLogoDecoration lerp(FlutterLogoDecoration a, FlutterLogoDecoration b, double t) {
  assert(a == null || a.debugAssertIsValid());
  assert(b == null || b.debugAssertIsValid());
  if (a == null && b == null)
    return null;
  if (a == null) {
    return new FlutterLogoDecoration._(
      b.swatch,
      b.textColor,
      b.style,
      b._position,
      b._opacity * t.clamp(0.0, 1.0),
      b.margin * t,
    );
  }
  if (b == null) {
    return new FlutterLogoDecoration._(
      a.swatch,
      a.textColor,
      a.style,
      a._position,
      a._opacity * (1.0 - t).clamp(0.0, 1.0),
      a.margin * t,
    );
  }
  return new FlutterLogoDecoration._(
    _lerpSwatch(a.swatch, b.swatch, t),
    Color.lerp(a.textColor, b.textColor, t),
    t < 0.5 ? a.style : b.style,
    a._position + (b._position - a._position) * t,
    (a._opacity + (b._opacity - a._opacity) * t).clamp(0.0, 1.0),
    EdgeInsets.lerp(a.margin, b.margin, t),
  );
}