You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
And the following [presets](#use-a-projection-preset)
149
+
144
150
-`globe` - Globe projection
145
151
146
-
This value can be uses either with a single projection or as an intermediate between two.
152
+
The `projectionTransition` output sent to the renderer is always of the shape:
147
153
148
-
It's possible to use an expression to change projection between zoom levels using a [`camera expression`](./expressions.md#camera-expressions), either with an immediate [`step`](./expressions.md#step), or an animated [`interpolate-projection`](./expressions.md#interpolate-projection).
154
+
`[from, to, transition]: [string, string, number]`
149
155
150
-
**Use a single projection**
156
+
-`from` is the transition of lower zoom level
157
+
-`to` is the transition of higher zoom level
158
+
-`transition` is the interpolation value, going from 0 to 1, with 0 being in the `from` projection, and 1 being in the `to` projection.
151
159
152
-
```ts
153
-
type: "mercator"
154
-
```
160
+
In case `from` and `to` are equal, the `transition` will have no effect.
161
+
162
+
### Examples
163
+
164
+
#### Step between projection at discrete zoom levels
165
+
166
+
Use a [`camera expression`](./expressions.md#camera-expressions), to discretely [`step`](./expressions.md#step) between projections at certain zoom levels.
155
167
156
-
**Change projection at zoom level**
157
168
158
169
```ts
159
170
type: ["step", ["zoom"],
@@ -162,18 +173,50 @@ type: ["step", ["zoom"],
162
173
]
163
174
```
164
175
165
-
**Animate between different projections based on zoom level**
176
+
`output at zoom 10.9: ["globe", "globe", 1]`
177
+
`output at zoom 11.0: ["globe", "globe", 1]`
178
+
`output at zoom 11.1: ["mercator", "mercator", 1]`
179
+
180
+
#### Animate between different projections based on zoom level**
181
+
182
+
Use a [`camera expression`](./expressions.md#camera-expressions), to animate between projections based on zoom, using [`interpolate-projection`](./expressions.md#interpolate-projection) function. The example below will yield an adaptive globe that transitions from `stereographic` to `mercator` between zoom 10 and 12.
Copy file name to clipboardExpand all lines: src/reference/v8.json
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -3065,7 +3065,7 @@
3065
3065
}
3066
3066
},
3067
3067
"interpolate-projection": {
3068
-
"doc": "Produces continuous, smooth results by interpolating between pairs of input and output values (\"stops\"). Works like `interpolate`, but the output type must be a projection transition of shape `[from, to, transition]: [string, string, number]`.",
3068
+
"doc": "Produces continuous, smooth results by interpolating between pairs of input and output values (\"stops\"). Works like `interpolate`, but the output type must be a [`projection transition](./types.md#projection-transition).",
0 commit comments