Scene
Note: This documentation is for the old 0.1.0 version of A-Frame. Check out the documentation for the current 1.7.0 version
Scenes, defined as <a-scene> set up what to render, where to render, and is where all of the entities live.
Initialization
In A-Frame, the scene handles most of the initialization including:
- Creating a canvas
- Instantiating a renderer
- Attaching event and full screen listeners
- Setting up default lighting and camera
- Injecting
<meta>tags and button to Enter VR - Registering keyboard shortcuts
Notably, the scene waits for all declaratively defined entities to load (by waiting on their loaded events) before kicking off the render loop.
Render Loop
The scene handles the render loop under a requestAnimationFrame. On each tick the scene will render itself and all of its entities to the canvas. At this point animations and any other registered behaviors are ticked or updated.
Events
| Name | Description |
|---|---|
| loaded | Emitted when all declaratively defined elements on the scene has loaded and when the scene has started rendering. |
Keyboard Shortcuts
The scene sets a couple of keyboard shortcuts:
fenters full-screen mode (and stereo-rendering [VR] mode if available).zresets the headset sensors (if available).
Stats
To view performance statistics, enable the stats component on <a-scene>:
<a-scene stats="true"></a-scene> |