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 optionsBounce options.
Name Type Description resolutionnumber experimental The resolution to start the bounce from, typically
map.getView().getResolution().startnumber | undefined experimental The start time of the animation. Default is immediately.
durationnumber | undefined experimental The duration of the animation in milliseconds. Default is
1000.easingfunction experimental The easing function to use. Can be an
ol.easingor a custom function. Default isol.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 optionsPan options.
Name Type Description sourceol.Coordinate experimental The location to start panning from, typically
map.getView().getCenter().startnumber | undefined experimental The start time of the animation. Default is immediately.
durationnumber | undefined experimental The duration of the animation in milliseconds. Default is
1000.easingfunction experimental The easing function to use. Can be an
ol.easingor a custom function. Default isol.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 optionsRotate options.
Name Type Description rotationnumber | undefined experimental The rotation value (in radians) to begin rotating from, typically
map.getView().getRotation(). Ifundefinedthen0is assumed.anchorol.Coordinate | undefined experimental The rotation center/anchor. The map rotates around the center of the view if unspecified.
startnumber | undefined experimental The start time of the animation. Default is immediately.
durationnumber | undefined experimental The duration of the animation in milliseconds. Default is
1000.easingfunction experimental The easing function to use. Can be an
ol.easingor a custom function. Default isol.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 optionsZoom options.
Name Type Description resolutionnumber experimental number The resolution to begin zooming from, typically
map.getView().getResolution().startnumber | undefined experimental The start time of the animation. Default is immediately.
durationnumber | undefined experimental The duration of the animation in milliseconds. Default is
1000.easingfunction experimental The easing function to use. Can be an
ol.easingor a custom function. Default isol.easing.inAndOut.Returns:
Pre-render function.
OpenLayers 3