Namespace: animation

ol.animation

The animation static methods are designed to be used with the ol.Map#beforeRender method. For example:

var map = new ol.Map({ ... });
var zoom = ol.animation.zoom({
  resolution: map.getView().getResolution()
});
map.beforeRender(zoom);
map.getView().setResolution(map.getView().getResolution() * 2);

Methods

ol.animation.bounce(options){ol.PreRenderFunction} experimental

src/ol/animation.js, line 16

Generate an animated transition that will "bounce" the resolution as it approaches the final value.

Name Type Description
options

Bounce options.

Name Type Description
resolution number experimental

The resolution to start the bounce from, typically map.getView().getResolution().

start number | undefined experimental

The start time of the animation. Default is immediately.

duration number | undefined experimental

The duration of the animation in milliseconds. Default is 1000.

easing function experimental

The easing function to use. Can be an ol.easing or a custom function. Default is ol.easing.upAndDown.

Returns:
Pre-render function.

ol.animation.pan(options){ol.PreRenderFunction} experimental

src/ol/animation.js, line 52

Generate an animated transition while updating the view center.

Name Type Description
options

Pan options.

Name Type Description
source ol.Coordinate experimental

The location to start panning from, typically map.getView().getCenter().

start number | undefined experimental

The start time of the animation. Default is immediately.

duration number | undefined experimental

The duration of the animation in milliseconds. Default is 1000.

easing function experimental

The easing function to use. Can be an ol.easing or a custom function. Default is ol.easing.inAndOut.

Returns:
Pre-render function.

ol.animation.rotate(options){ol.PreRenderFunction} experimental

src/ol/animation.js, line 92

Generate an animated transition while updating the view rotation.

Name Type Description
options

Rotate options.

Name Type Description
rotation number | undefined experimental

The rotation value (in radians) to begin rotating from, typically map.getView().getRotation(). If undefined then 0 is assumed.

anchor ol.Coordinate | undefined experimental

The rotation center/anchor. The map rotates around the center of the view if unspecified.

start number | undefined experimental

The start time of the animation. Default is immediately.

duration number | undefined experimental

The duration of the animation in milliseconds. Default is 1000.

easing function experimental

The easing function to use. Can be an ol.easing or a custom function. Default is ol.easing.inAndOut.

Returns:
Pre-render function.

ol.animation.zoom(options){ol.PreRenderFunction} experimental

src/ol/animation.js, line 138

Generate an animated transition while updating the view resolution.

Name Type Description
options

Zoom options.

Name Type Description
resolution number experimental

number The resolution to begin zooming from, typically map.getView().getResolution().

start number | undefined experimental

The start time of the animation. Default is immediately.

duration number | undefined experimental

The duration of the animation in milliseconds. Default is 1000.

easing function experimental

The easing function to use. Can be an ol.easing or a custom function. Default is ol.easing.inAndOut.

Returns:
Pre-render function.