Skip to content

gi-nx


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

Properties

PropertyTypeDescription
animate?booleanIf false, no animation will occur.
curve?numberThe 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?numberThe animation's duration, measured in milliseconds.
easing?(_: number) => numberA 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?booleanIf true, then the animation is considered essential and will not be affected by prefers-reduced-motion.
linear?boolean-
maxDuration?numberThe animation's maximum duration, measured in milliseconds. If duration exceeds maximum duration, it resets to 0.
offset?PointLikeThe target center's offset relative to real map container center at the end of animation.
preloadOnly?booleanIf true, it will trigger tiles loading across the animation path, but no animation will occur.
screenSpeed?numberThe average speed of the animation measured in screenfuls per second, assuming a linear timing curve. If speed is specified, this option is ignored.
speed?numberThe 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.