requestAnimationFrame
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.
Parameters:
Name | Type | Description |
---|---|---|
callback |
Function | The function to call when animation is ready. |
Returns:
An ID that can be passed to @{link 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(); requestAnimationFrame(tick); } tick();