A-Frame can be developed from a plain HTML file without having to install anything! A great way to try out A-Frame to remix the starter example on Glitch, an online code editor that instantly hosts and deploys for free. Or create an .html
file and include A-Frame in the head
:
<html>
<head>
<script src="https://aframe.io/releases/0.5.0/aframe.min.js"></script>
</head>
<body>
<a-scene>
<a-box position="-1 0.5 -3" rotation="0 45 0" color="#4CC3D9"></a-box>
<a-sphere position="0 1.25 -5" radius="1.25" color="#EF2D5E"></a-sphere>
<a-cylinder position="1 0.75 -3" radius="0.5" height="1.5" color="#FFC65D"></a-cylinder>
<a-plane position="0 0 -4" rotation="-90 0 0" width="4" height="4" color="#7BC8A4"></a-plane>
<a-sky color="#ECECEC"></a-sky>
</a-scene>
</body>
</html>
To include A-Frame into an HTML file, we drop a script
tag pointing to the CDN build:
<head>
<script src="https://aframe.io/releases/0.5.0/aframe.min.js"></script>
</head>
We can also install A-Frame through npm:
$ npm install aframe
Then we can bundle A-Frame into our application. For example, with Browserify or Webpack:
require('aframe');
If you use npm, you can use angle, a command line interface for A-Frame. angle can initialize a scene template with a single command:
npm install -g angle && angle initscene