lerpList<T> function

  1. @visibleForTesting
List<T>? lerpList<T>(
  1. List<T>? a,
  2. List<T>? b,
  3. double t, {
  4. required T lerp(
    1. T,
    2. T,
    3. double
    ),
})

Implementation

@visibleForTesting
List<T>? lerpList<T>(
  List<T>? a,
  List<T>? b,
  double t, {
  required T Function(T, T, double) lerp,
}) {
  if (a != null && b != null && a.length == b.length) {
    return List.generate(a.length, (i) {
      return lerp(a[i], b[i], t);
    });
  } else if (a != null && b != null) {
    return List.generate(b.length, (i) {
      return lerp(i >= a.length ? b[i] : a[i], b[i], t);
    });
  } else {
    return b;
  }
}