A scene is represented by the <a-scene> element. The scene is the global root
object, and all entities are contained within the scene.
The scene inherits from the Entity class so it inherits all of its
properties, its methods, the ability to attach components, and the behavior to
wait for all of its child nodes (e.g., <a-assets> and <a-entity>) to load
before kicking off the render loop.
<a-scene> handles all of the three.js and WebVR/WebXR boilerplate for us:
Added and removed when entering and exiting VR, respectively. Check with sceneEl.is('vr-mode').
Methods
Name
Description
enterVR
Switch to stereo render and push content to the headset. Needs to be called within a user-generated event handler like click. the first time a page enters VR.
exitVR
Switch to mono renderer and stops presenting content on the headset.
Events
Name
Description
enter-vr
User has entered VR and headset started presenting content.
exit-vr
User has exited VR and headset stopped presenting content.
loaded
All nodes have loaded.
renderstart
Render loop has started.
Scene Components
Components can be attached to the scene as well as entities:
<a-scenefogstats>
A-Frame ships with a few components to configure the scene:
embedded - Remove fullscreen styles from the canvas.