lerp static method

BarGroup lerp(
  1. BarGroup? current,
  2. BarGroup target,
  3. double t
)

Lerps between two BarGroup objects for a factor t.

If subtypes of the two objects are not identical, then it lerps from null to target object's type.

Implementation

static BarGroup lerp(BarGroup? current, BarGroup target, double t) {
  final currentValue =
      current == null || current.runtimeType != target.runtimeType
          ? null
          : current;
  return target._when(
    simpleBar: () => SimpleBar.lerp(currentValue, target, t),
    multiBar: () => MultiBar.lerp(currentValue, target, t),
  );
}