Interface: AnimationConfig
Parameters to configure the route animation.
Properties
autoFitByPlace?
optional autoFitByPlace?: object;(Optional) Configuration for automatic map fitting when the route crosses different places/buildings. When enabled, the map will automatically adjust its view to show only the steps within the current place when the route animation enters a new place. This is particularly useful for indoor navigation where routes may cross multiple buildings or floors.
enabled
enabled: booleanWhether automatic fitting by place is enabled. When true, the map will automatically adjust its
bounds when the route enters a new place. Must be explicitly set to true to enable this feature.
padding?
optional padding?: PaddingOptions;(Optional) Padding in pixels to be added around the fitted bounds. If not provided, defaults to
{ top: 150, right: 150, bottom: 150, left: 150 }. Each value represents the padding for the
respective edge of the viewport.
Default Value
{ top: 150, right: 150, bottom: 150, left: 150 }
Example
// Enable auto-fit with custom padding
const animationConfig: AnimationConfig = {
callBack: ({ isFinished, step }) => {
console.log("Step:", step)
},
autoFitByPlace: {
enabled: true,
padding: { top: 200, right: 200, bottom: 200, left: 200 },
},
}
// Enable auto-fit with default padding (150px on all sides)
const animationConfig2: AnimationConfig = {
callBack: ({ isFinished, step }) => {},
autoFitByPlace: {
enabled: true,
},
}Default Value
undefined (disabled by default for backward compatibility)
callBack?
optional callBack?: (status) => void;(Optional) A function that receive the status of the animation.
In a route animation:
- While the animation is running, this is called at the start of the animation of each step.
- When the animation es finished, this is called again a single time with
{ isFinished: true; step: null }.
In a step by step animation:
- Initially will be called with the first step to animate.
- At the end of each step animation:
- If there exist more step to animate, it will be called with the next step to animate.
- Else, it will be called with
{ isFinished: true; step: null }.
Parameters
status
The status of the animation.
Returns
void
changeFloorTime?
optional changeFloorTime?: number;(Optional) The time in seconds to wait before changing the floor when the step is a changing floor step.
Default Value
0
iconRotationTime?
optional iconRotationTime?: number;(Optional) The time in seconds to use in the rotation of the icon.
Default Value
0
keepFixedBearing?
optional keepFixedBearing?: boolean;(Optional) Keep a fixed camera orientation during route animation. When true, the camera follows
the animated marker position but does not rotate with route bearing changes. When false, the
current behavior is preserved and the camera bearing is updated based on route direction.
Default Value
false
minimumSpeed?
optional minimumSpeed?: number;(Optional) The minimum speed in m/s to use in the animation. If the calculated speed for the animation of a step is less than this, this will be used for its animation.
The default of 40 m/s (144 km/h) suits large outdoor venues. It is a floor, so it overrides
AnimationConfig.stepTime on any step shorter than stepTime * minimumSpeed metres,
which then snaps past in a fraction of the intended time. Indoors, where steps are typically a few
metres, set a walking-scale value such as 8 to keep short steps legible.
Default Value
40
stepTime?
optional stepTime?: number;(Optional) The time in seconds to use for each step animation. If omitted, default to 3.
This is wall-clock time and does not depend on the frame rate: the marker covers as much of the step
as the elapsed time entitles it to on each frame, however many polyline vertices that spans. A step
still cannot run faster than step.distance / minimumSpeed seconds, since the speed is floored by
AnimationConfig.minimumSpeed.
Time in which the animation did not run at all is not counted. Browsers stop firing animation frames
in a backgrounded tab, so a route left in one resumes where it stopped rather than jumping ahead by
however long the tab was away; the step then takes stepTime of visible animation.
Default Value
3