gi-nx / AnimationOptions
ts
type AnimationOptions = {
animate?: boolean;
curve?: number;
duration?: number;
easing?: (_: number) => number;
essential?: boolean;
linear?: boolean;
maxDuration?: number;
offset?: PointLike;
preloadOnly?: boolean;
screenSpeed?: number;
speed?: number;
};Options common to map movement methods that involve animation, such as Map#panBy and Map#easeTo, controlling the duration and easing function of the animation. All properties are optional.
See
- Example: Slowly fly to a location
- Example: Customize camera animations
- Example: Navigate the map with game-like controls
Properties
| Property | Type | Description |
|---|---|---|
animate? | boolean | If false, no animation will occur. |
curve? | number | 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 Map#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. If minZoom is specified, this option will be ignored. |
duration? | number | The animation's duration, measured in milliseconds. |
easing? | (_: number) => number | A function taking a time in the range 0..1 and returning a number where 0 is the initial state and 1 is the final state. |
essential? | boolean | If true, then the animation is considered essential and will not be affected by prefers-reduced-motion. |
linear? | boolean | - |
maxDuration? | number | The animation's maximum duration, measured in milliseconds. If duration exceeds maximum duration, it resets to 0. |
offset? | PointLike | The target center's offset relative to real map container center at the end of animation. |
preloadOnly? | boolean | If true, it will trigger tiles loading across the animation path, but no animation will occur. |
screenSpeed? | number | The average speed of the animation measured in screenfuls per second, assuming a linear timing curve. If speed is specified, this option is ignored. |
speed? | number | The average speed of the animation defined in relation to curve. A speed of 1.2 means that the map appears to move along the flight path by 1.2 times 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. |