# Interpolators

### Interpolators

Interpolators are functions that use the current zoom level to get you a value. The following interpolators are currently supported:

#### Step

`{ "step": [output0, Stops[]] }`: Computes discrete results by evaluating a piecewise-constant function defined by stops on a given input. Returns the output value of the stop with a stop input value just less than the input one. If the input value is less than the input of the first stop, `output0` is returned.

Stops are defined as pairs of `[zoom, value]` where `zoom` is the minimum zoom level where `value` is returned and `value` can be `number | string | boolean`. Note that stops need to be defined by increasing zoom level.

```jsx
{ "step": ["hsl(50,5%,72%)", [[9, "hsl(10,75%,75%)"]] }
// If zoom level is less than 9, "hsl(50,5%,72%)" will be returned
// If zoom level is equal or higher than 9, "hsl(10,75%,75%)" will be returned

```

The following image shows the behavior of this definition:

```jsx
{ "step": [0, [[0, 0], [100, 100]]]} // Blue
{ "step": [0, [[0, 0], [50, 50], [100, 100]]]} // Red
{ "step": [0, [[0, 0], [25, 25], [50, 50], [75, 75], [100, 100]]]} // Yellow

```

<figure><img src="https://293097899-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLlIfNdbm4rCsu755xrdc%2Fuploads%2FO8ys0cggt6oZjGeR2VSy%2Fstep_interpolator_graph.png?alt=media&#x26;token=2765ed5b-3dc6-4910-8802-67ab8f10efb3" alt="Graph showing a Step interpolator function"><figcaption></figcaption></figure>

#### Linear

`{ "linear": Stops[] }`: Linearly interpolates between stop values less than or equal and greater than the input value

```jsx
{
  "linear": [
    [8, 10],
    [14, 15],
    [20, 21]
  ]
}
// If zoom level is less than 8, 10 is returned
// If zoom level is greater or equal than 8 but less than 14, a value linearly interpolated
// between 10 and 15 is returned
// If zoom level is greater or equal than 14 but less than 20, a value linearly interpolated // between 15 and 21 is returned
// If zoom level is greater or equal than 20, 21 is returned

```

The following image shows the behaviour of this definitions

```jsx
{ "linear": [[0, 0], [100, 100]]} // Blue
{ "linear": [[0, 0], [50, 50], [100, 100]]} // Red
{ "linear": [[0, 0], [25, 25], [50, 50], [75, 75], [100, 100]]} // Yellow

```

<figure><img src="https://293097899-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLlIfNdbm4rCsu755xrdc%2Fuploads%2FcdU4ysMCOiIA7KNG7WYd%2Flinear_interpolator_graph.png?alt=media&#x26;token=c0f5fb8b-14d9-4af4-b6a1-f1f3aaeaf1a8" alt="Graph showing a Linear interpolator function"><figcaption></figcaption></figure>

`{ "linear": [number, number] }`: Expands to `{ "linear": [[minZoom, number], [maxZoom, number] }`

```jsx
{ "linear": [8, 10] }
// If minZoom is defined as 3 and maxZoom is defined as 20:
// If zoom level is less than 3, 8 is returned
// If zoom level is between 3 and 20, a value linearly interpolated between 8 and 10 is
// returned
// If zoom level is greater or equal than 20, 10 is returned

```

Color linear interpolation is done in the HCL color-space

#### Exponential

`{ "exp": [number, Stops[]] }`: Exponentially interpolates between output stop values less than or equal and greater than the input value. The base parameter controls the rate at which output increases where higher values increase the output value towards the end of the range, lower values increase the output value towards the start of the range, and a base 1 interpolates linearly.

The used value is computed as follows : `(Math.pow(base, progress) - 1) / (Math.pow(base, difference) - 1)`

```jsx
{
  "exp": [
    0.25,
    [
      [0, 25],
      [10, 100]
    ]
  ]
}
// If zoom level is less than 0, 25 is returned
// If zoom level z is between 0 and 10, an interpolation factor is computed between 0 and 10
// and then it's used to interpolate between 25 and 100
// If zoom level is equal or higher than 10, 100 will be returned

```

The following images shows the behaviour of this definition

```jsx
{ "exp": [0.25, [[0, 0], [100, 100]]]} // Blue
{ "exp": [0.25, [[0, 0], [50, 50], [100, 100]]]} // Red
{ "exp": [0.25, [[0, 0], [25, 25], [50, 50], [75, 75], [100, 100]]]} // Yellow
```

![](https://293097899-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLlIfNdbm4rCsu755xrdc%2Fuploads%2FY5Yb9hIXYVPJJvPbDW5k%2Fexponential_interpolator_graph.png?alt=media\&token=31abc970-0378-49d5-8b67-6bf76182a3a0)

```jsx
{ "exp": [0.5, [[0, 0], [100, 100]]]} // Blue
{ "exp": [0.5, [[0, 0], [50, 50], [100, 100]]]} // Red
{ "exp": [0.5, [[0, 0], [25, 25], [50, 50], [75, 75], [100, 100]]]} // Yellow
```

![](https://293097899-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLlIfNdbm4rCsu755xrdc%2Fuploads%2F2QmtruwwFpTeHsZpwy9w%2Fexponential_interpolator_graph_050.png?alt=media\&token=f48098c0-6134-4ffd-a1e8-aafe56663799)

```jsx
{ "exp": [0.75, [[0, 0], [100, 100]]]} // Blue
{ "exp": [0.75, [[0, 0], [50, 50], [100, 100]]]} // Red
{ "exp": [0.75, [[0, 0], [25, 25], [50, 50], [75, 75], [100, 100]]]} // Yellow
```

![](https://293097899-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLlIfNdbm4rCsu755xrdc%2Fuploads%2FuqwXJHaH7VMmcWSAVIH6%2Fexponential_interpolator_graph_075.png?alt=media\&token=16b17e4e-8133-4a78-b3ed-949803864220)

```jsx
{ "exp": [1, [[0, 0], [100, 100]]]} // Blue
{ "exp": [1, [[0, 0], [50, 50], [100, 100]]]} // Red
{ "exp": [1, [[0, 0], [25, 25], [50, 50], [75, 75], [100, 100]]]} // Yellow
```

![](https://293097899-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLlIfNdbm4rCsu755xrdc%2Fuploads%2FwwyhGyrvj2dBra9bZPSc%2Fexponential_interpolator_graph_100.png?alt=media\&token=17d8b1a3-0322-42db-9d46-61920b4470ac)

```jsx
{ "exp": [1.25, [[0, 0], [100, 100]]]} // Blue
{ "exp": [1.25, [[0, 0], [50, 50], [100, 100]]]} // Red
{ "exp": [1.25, [[0, 0], [25, 25], [50, 50], [75, 75], [100, 100]]]} // Yellow
```

![](https://293097899-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLlIfNdbm4rCsu755xrdc%2Fuploads%2FmAHBr9UTQZatGBoTTo6v%2Fexponential_interpolator_graph_125.png?alt=media\&token=3c19a566-bdf8-4020-8ae0-9ae027746f5e)

```jsx
{ "exp": [2, [[0, 0], [100, 100]]]} // Blue
{ "exp": [2, [[0, 0], [50, 50], [100, 100]]]} // Red
{ "exp": [2, [[0, 0], [25, 25], [50, 50], [75, 75], [100, 100]]]} // Yellow
```

![](https://293097899-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLlIfNdbm4rCsu755xrdc%2Fuploads%2FEi3vzoEa2S8zEw8cLgKE%2Fexponential_interpolator_graph_200.png?alt=media\&token=a77ef61c-e0fb-4c43-8eff-e9079a0bcf7e)

#### Cubic Bezier

`{ "cubicbezier": [number, number, number, number, Stops[]] }`: Interpolates using the bezier curve defined by the curve control points.

The following images shows the behaviour of this definition

```jsx
{ "cubicbezier": [0.25, 0, 0.75, 1.5, [[0, 0], [100, 100]]]} // Blue
{ "cubicbezier": [0.25, 0, 0.75, 1.5, [[0, 0], [50, 50], [100, 100]]} // Red
{ "cubicbezier": [0.25, 0, 0.75, 1.5, [[0, 0], [25, 25], [50, 50], [75, 75], [100, 100]]} // Yellow
```

![](https://293097899-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLlIfNdbm4rCsu755xrdc%2Fuploads%2F1I1uUHhc3W1ATiktPEet%2Fcubic_bezier_interpolator_graph.png?alt=media\&token=88cadd78-c166-4edb-94c0-00f35759e5f9)

## Default values


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developers.felt.com/felt-style-language/zoom-based-styling/interpolators.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
