hclErp static method

Implementation

static EmergentBoxShape? hclErp(
    EmergentBoxShape? a, EmergentBoxShape? b, double t) {
  if (a == null && b == null) return null;

  if (t == 0.0) return a;
  if (t == 1.0) return b;

  if (a == null) {
    if (b!.isCircle || b.isRect || b.isStadium || b.isCustomPath) {
      return b;
    } else {
      return EmergentBoxShape.roundRect(BorderRadius.lerp(
        null,
        (b.customShapePathProvider as RRectPathProvider).borderRadius,
        t,
      )!);
    }
  }
  if (a.isCircle || a.isRect || a.isStadium || a.isCustomPath) {
    return a;
  }

  if (b == null) {
    if (a.isCircle || a.isRect || a.isStadium || a.isCustomPath) {
      return a;
    } else {
      return EmergentBoxShape.roundRect(BorderRadius.lerp(
        null,
        (a.customShapePathProvider as RRectPathProvider).borderRadius,
        t,
      )!);
    }
  }
  if (b.isCircle || b.isRect || b.isStadium || b.isCustomPath) {
    return b;
  }

  if (a.isBeveled && b.isBeveled) {
    return EmergentBoxShape.beveled(BorderRadius.lerp(
      (a.customShapePathProvider as BeveledPathProvider).borderRadius,
      (b.customShapePathProvider as BeveledPathProvider).borderRadius,
      t,
    )!);
  }

  return EmergentBoxShape.roundRect(BorderRadius.lerp(
    (a.customShapePathProvider as RRectPathProvider).borderRadius,
    (b.customShapePathProvider as RRectPathProvider).borderRadius,
    t,
  )!);
}