interpolate method

ColorModel interpolate(
  1. ColorModel end,
  2. double step
)

Interpolates to step between this and end.

Implementation

ColorModel interpolate(ColorModel end, double step) {
  end = convert(end);
  final valuesA = this is RgbColor
      ? (this as RgbColor).toPreciseListWithAlpha()
      : toListWithAlpha();
  final valuesB =
      end is RgbColor ? end.toPreciseListWithAlpha() : end.toListWithAlpha();
  return withValues(List<num>.generate(valuesA.length,
      (index) => _interpolateValue(valuesA[index], valuesB[index], step)));
}