flyTo(
options:FlyToOptions,eventData?:any):this
Defined in: ui/map.ts:1540
Changes any combination of center, zoom, bearing, pitch, and roll, animating the transition along a curve that evokes flight. The animation seamlessly incorporates zooming and panning to help the user maintain her bearings even after traversing a great distance.
Reduced Motion
The animation will be skipped, and this will behave equivalently to jumpTo
if the user has the reduced motion accessibility feature enabled in their operating system,
unless 'options' includes essential: true.
Triggers the following events: movestart, move, moveend, zoomstart, zoom, zoomend, pitchstart,
pitch, pitchend, rollstart, roll, rollend, and rotate.
Parameters
| Parameter | Type | Description |
|---|---|---|
options |
FlyToOptions |
Options describing the destination and animation of the transition. Accepts CameraOptions, AnimationOptions, and the following additional options. |
eventData? |
any |
Additional properties to be added to event objects of events triggered by this method. |
Returns
this
Example
// fly with default options to null island
map.flyTo({center: [0, 0], zoom: 9});
// using flyTo options
map.flyTo({
center: [0, 0],
zoom: 9,
speed: 0.2,
curve: 1,
easing(t) {
return t;
}
});
See
- Fly to a location
- Slowly fly to a location
- Fly to a location based on scroll position