hclErp static method

Implementation

static EmergentTextDecoration? hclErp(
    EmergentTextDecoration? a, EmergentTextDecoration? b, double t) {
  //print("hclErp $t ${a.style.depth}, ${b.style.depth}");

  if (a == null && b == null) return null;
  if (a == null) return b!.scale(t);
  if (b == null) return a.scale(1.0 - t);
  if (t == 0.0) {
    //print("return a");
    return a;
  }
  if (t == 1.0) {
    //print("return b (1.0)");
    return b;
  }

  var aStyle = a.style;
  var bStyle = b.style;

  return EmergentTextDecoration(
      isForeground: a.isForeground,
      text: a.text,
      textAlign: a.textAlign,
      textStyle:
          TextStyle.lerp(a.textStyle, b.textStyle, t) ?? const TextStyle(),
      renderingByPath: a.renderingByPath,
      style: a.style.copyWith(
        border: EmergentBorder.hclErp(aStyle.border, bStyle.border, t),
        intensity: lerpDouble(aStyle.intensity, bStyle.intensity, t),
        depth: lerpDouble(aStyle.depth, bStyle.depth, t),
        color: Color.lerp(aStyle.color, bStyle.color, t),
        lightSource:
            LightSource.hclErp(aStyle.lightSource, bStyle.lightSource, t),
      ));
}