liveBook · Manning

WebXR

As explained in Web Components in Action

WebXR is a web API standard for accessing virtual, augmented, and other immersive device capabilities.

Want a browser experience that reaches beyond a flat screen? WebXR is the emerging successor to WebVR, named to include augmented reality and other immersive modes alongside virtual reality. WebVR defined a JavaScript API for displaying VR and receiving headset and controller position and rotation input; experiments with it helped motivate a new round of standards work. Do not treat the transition as a settled compatibility guarantee. section 15.2

For a feel for the surrounding 3D workflow, an A-Frame scene declares objects with HTML-like elements while a canvas renders the result. That is a WebVR example, not a demonstration of direct WebXR API calls. section 15.2

Listing 15.2. A-Frame hello WebVR scene
<html>
<head>
   <title>Hello, WebVR! • A-Frame</title>
   <script src="aframe.min.js"></script>                                   #1
</head>
<body>
<a-scene background="color: #ECECEC">                                      #2
        <a-box position="-1 0.5 -3" rotation="0 45 0" color="#4CC3D9" shadow>
        </a-box>                                                           #3
        <a-sphere position="0 1.25 -5" radius="1.25" color="#EF2D5E" shadow>
        </a-sphere>
        <a-cylinder position="1 0.75 -3" radius="0.5" height="1.5" color=
        "#FFC65D" shadow></a-cylinder>
        <a-plane position="0 0 -4" rotation="-90 0 0" width="4" height="4"
        color="#7BC8A4" shadow></a-plane>
</a-scene>
</body>
</html>

Explore the small A-Frame WebVR scene to see the kind of immersive page motivating the WebXR transition. section 15.2

How Web Components in Action covers it

How deep it goes
Explains the naming and standards transition but provides no direct WebXR API walkthrough.
Examples
Uses an A-Frame WebVR scene with HTML-like 3D objects as context, not as a WebXR implementation.
What you can do after
Evaluate/understand the WebVR-to-WebXR transition without assuming that a WebVR example demonstrates WebXR support.
How it connects
Connects WebXR to WebVR, augmented reality, virtual reality, Web Components, and A-Frame.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Web Components in Action. The section links point to the parts of the book it draws on.