--- title: VRDisplay.requestAnimationFrame() slug: Web/API/VRDisplay/requestAnimationFrame translation_of: Web/API/VRDisplay/requestAnimationFrame ---
{{APIRef("WebVR API")}}{{SeeCompatTable}}

The requestAnimationFrame() method of the {{domxref("VRDisplay")}} interface is a special implementation of {{domxref("Window.requestAnimationFrame")}} containing a callback function that will be called every time a new frame of the VRDisplay presentation is rendered:

Syntax

var handle = vrDisplayInstance.requestAnimationFrame(callback);

Parameters

callback
A callback function that will be called every time a new frame of the VRDisplay presentation is rendered.

Return value

A long representing the handle of the requestAnimationFrame() call. This can then be passed to a {{domxref("VRDisplay.cancelAnimationFrame()")}} call to unregister the callback.

Examples

TBD.

Specifications

Specification Status Comment
{{SpecName('WebVR', '#dom-vrdisplay-requestanimationframe', 'requestAnimationFrame()')}} {{Spec2('WebVR')}} Initial definition

Browser compatibility

{{Compat("api.VRDisplay.requestAnimationFrame")}}

See also