OpenLayers.Animation

A collection of utility functions for executing methods that repaint a portion of the browser window.  These methods take advantage of the browser’s scheduled repaints where requestAnimationFrame is available.

Summary
OpenLayers.AnimationA collection of utility functions for executing methods that repaint a portion of the browser window.
Properties
isNative{Boolean} true if a native requestAnimationFrame function is available
Functions
requestFrameSchedule a function to be called at the next available animation frame.
startExecutes a method with requestFrame in series for some duration.
stopTerminates an animation loop started with start.

Properties

isNative

{Boolean} true if a native requestAnimationFrame function is available

Functions

requestFrame

Schedule a function to be called at the next available animation frame.  Uses the native method where available.  Where requestAnimationFrame is not available, setTimeout will be called with a 16ms delay.

Parameters

callback{Function} The function to be called at the next animation frame.
element{DOMElement} Optional element that visually bounds the animation.

start

function start(callback,
duration,
element)

Executes a method with requestFrame in series for some duration.

Parameters

callback{Function} The function to be called at the next animation frame.
duration{Number} Optional duration for the loop.  If not provided, the animation loop will execute indefinitely.
element{DOMElement} Optional element that visually bounds the animation.

Returns

{Number} Identifier for the animation loop.  Used to stop animations with stop.

stop

function stop(id)

Terminates an animation loop started with start.

Parameters

id{Number} Identifier returned from start.
function start(callback,
duration,
element)
Executes a method with requestFrame in series for some duration.
Schedule a function to be called at the next available animation frame.
function stop(id)
Terminates an animation loop started with start.
Close