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