interpolate

Produces continuous, smooth results by interpolating between pairs of input and output values (\"stops\"). The `input` may be any numeric expression (e.g., `[\"get\", \"population\"]`). Stop inputs must be numeric literals in strictly ascending order. The output type must be `number`, `array`, or `color`.

Example usage:


FillLayer fillLayer = new FillLayer("layer-id", "source-id");
fillLayer.setProperties(
  fillColor(
    interpolate(exponential(0.5f), zoom(),
       stop(1.0f, color(Color.RED)),
       stop(5.0f, color(Color.BLUE)),
       stop(10.0f, color(Color.GREEN)
      )
    )
  )
);

Return

expression

Parameters

interpolation

type of interpolation

number

the input expression

stops

pair of input and output values

See also


Produces continuous, smooth results by interpolating between pairs of input and output values (\"stops\"). The `input` may be any numeric expression (e.g., `[\"get\", \"population\"]`). Stop inputs must be numeric literals in strictly ascending order. The output type must be `number`, `array`, or `color`.

Example usage:


FillLayer fillLayer = new FillLayer("layer-id", "source-id");
fillLayer.setProperties(
    fillColor(
      interpolate(
        exponential(0.5f), zoom(),
        stop(1.0f, color(Color.RED)),
        stop(5.0f, color(Color.BLUE)),
        stop(10.0f, color(Color.GREEN))
      )
    )
);

Return

expression

Parameters

interpolation

type of interpolation

number

the input expression

stops

pair of input and output values

See also