flyTo method
Changes any combination of center, zoom, bearing, and pitch, 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.
Note: The animation will be skipped, and this will behave equivalently to jumpTo
if the user has the reduced motion
accesibility feature enabled in their operating system.
@memberof MapboxMap#
@param {Object} options Options describing the destination and animation of the transition.
Accepts {@link CameraOptions}, {@link AnimationOptions},
and the following additional options.
@param {number} options.curve=1.42
The zooming "curve" that will occur along the
flight path. A high value maximizes zooming for an exaggerated animation, while a low
value minimizes zooming for an effect closer to {@link MapboxMap#easeTo}. 1.42 is the average
value selected by participants in the user study discussed in
van Wijk (2003). A value of
Math.pow(6, 0.25)
would be equivalent to the root mean squared average velocity. A
value of 1 would produce a circular motion.
@param {number} options.minZoom
The zero-based zoom level at the peak of the flight path. If
options.curve
is specified, this option is ignored.
@param {number} options.speed=1.2
The average speed of the animation defined in relation to
options.curve
. A speed of 1.2 means that the map appears to move along the flight path
by 1.2 times options.curve
screenfuls every second. A screenful is the map's visible span.
It does not correspond to a fixed physical distance, but varies by zoom level.
@param {number} options.screenSpeed
The average speed of the animation measured in screenfuls
per second, assuming a linear timing curve. If options.speed
is specified, this option is ignored.
@param {number} options.maxDuration
The animation's maximum duration, measured in milliseconds.
If duration exceeds maximum duration, it resets to 0.
@param eventData Additional properties to be added to event objects of events triggered by this method.
@fires movestart
@fires zoomstart
@fires pitchstart
@fires move
@fires zoom
@fires rotate
@fires pitch
@fires moveend
@fires zoomend
@fires pitchend
@returns {MapboxMap} 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
@see Slowly fly to a location
@see Fly to a location based on scroll position
Implementation
MapboxMap flyTo(dynamic options, [String? eventData]) =>
MapboxMap.fromJsObject(jsObject
.flyTo(options is CameraOptions ? options.jsObject : jsify(options)));