interpolate<T> abstract method

T interpolate<T>(
  1. List<double> inputRange,
  2. List<T> outputRange, [
  3. Extrapolate extrapolate = Extrapolate.EXTEND,
  4. Extrapolate? right,
])

Maps an input value within a range to an output value within a range.

Also supports different types of extrapolation for when the value falls outside the range and mapping to strings. Usage

var opacity = val.interpolate(
  [1, 100], // input range
  [0, 1],  // output range
  Extrapolate.EXTEND, // right Extrapolation
  Extrapolate.EXTEND, // left Extrapolation
)

The third parameter is the is the right extrapolation and the last parameter is the left extrapolation.

If the left extrapolation is the specified the right extrapolation is used for the left extrapolation, and if any of the extrapolations is not specified, the default Extrapolate.EXTEND is used for both the left and the right.

In Color Interpolation the extrapolation is fixed to Extrapolate.CLAMP even if specified

Color Interpolation Example

var opacity = val.interpolate(
  [1, 100], // input range
  [Colors.red, Colors.green],  // output range
)

Implementation

T interpolate<T>(List<double> inputRange, List<T> outputRange,
    [Extrapolate extrapolate = Extrapolate.EXTEND, Extrapolate? right]);