// rendering loop for a VR scene
function drawVRScene() {
// WebVR: Request the next frame of the animation
vrSceneFrame = vrDisplay.requestAnimationFrame(drawVRScene);
// Populate frameData with the data of the next frame to display
vrDisplay.getFrameData(frameData);
// Retrieve the angular velocity values for use in rendering
// curFramePose is a VRPose object
const curFramePose = frameData.pose;
const angVel = curFramePose.angularVelocity;
const avx = angVel[0];
const avy = angVel[1];
const avz = angVel[2];
// render the scene
// …
// WebVR: submit the rendered frame to the VR display
vrDisplay.submitFrame();
}VRPose: angularVelocity property / notebook
VRPose: angularVelocity property
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.