Atlaslog
Atlaslog / MapLibre GL JS / API / flyTo
MapLibre GL JS · API reference

flyTo

Quick answer

flyTo ( options : FlyToOptions , eventData? : any ): this

Last verified 2026-11-03 · MapLibre GL JS 4.x · Cite this page
Runnable examplesChinese noteAll API topics
flyTo()

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


TutorialsAPI index
English reference text adapted from the official MapLibre GL JS documentation, © MapLibre contributors, licensed under BSD-3-Clause.
Original page: https://maplibre.org/maplibre-gl-js/docs/API/classes/Map/ · Chinese note: /maplibre/api/fly-to.html
Cite this page

Atlaslog (2026). flyTo. https://www.jingweizhi.com/en/maplibre/api/fly-to.html (accessed 2026-11-03).