requestAnimationFrame(callback)
A browser-independent function to request a new animation frame. This is used to create
an application's draw loop as shown in the example below.
Name | Type | Description |
---|---|---|
callback |
requestAnimationFrame~Callback | The function to call when the next frame should be drawn. |
Returns:
An ID that can be passed to
cancelAnimationFrame
to cancel the request.
Example:
// Create a draw loop using requestAnimationFrame. The
// tick callback function is called for every animation frame.
function tick() {
scene.render();
Cesium.requestAnimationFrame(tick);
}
tick();
See:
Type Definitions
-
Callback(timestamp)
-
A function that will be called when the next frame should be drawn.
Name Type Description timestamp
Number A timestamp for the frame, in milliseconds.