Mozilla Releases A-Frame WebVR Framework

by Sean 894 views0

Creating virtual reality applications has typically been a skill best left to 3D game developers. All of that is about to change however, thanks to Mozilla and the release of it’s new open source WebVR framework called A-Frame.

A-Frame was created to give web developers the ability to easily build, what are normally, very complex WebGL virtual reality elements, by wrapping them in simple HTML code.

Mozilla has been doing a lot of work and research over the past few years to bring VR to the browser, and A-Frame is a huge step towards giving web developers a set of simple tools and building blocks (much like web components) to explore and start creating more complex VR based websites that can work across multiple platforms.

Anyone with a basic understanding of HTML can use A-Frame. In the video above, I do a simple demonstration of just how easy it is to create simple VR elements using a very small piece of HTML code. The code immediately creates, not only a VR scene, but also includes the button which splits the screen when using a mobile browser in order to be used with VR headsets such as Google Cardboard.

In the video, I use the following code to create a cube in a simple HTML document and load it in my browser.


<html>
  <head>
    <title>My first A-Frame VR Code</title>
    <script src="https://aframe.io/releases/latest/aframe.min.js"></script>
  </head>
  <body>
    <a-scene>
      <a-cube></a-cube>
    </a-scene>
  </body>
</html>

This is the result:

greycube

With a few more adjustments of the code, I was able to create fog, colors, position and size.

<html>
  <head>
    <title>My first A-Frame VR Code</title>
    <script src="https://aframe.io/releases/latest/aframe.min.js"></script>
  </head>
  <body>
    <a-scene fog="type: linear; color: #fff; far: 30; near: 0">
      <a-cube position="-1 0.5 1" rotation="0 45 0" width="2" height="1" depth="2"  color="#4CC3D9"></a-cube>
       <a-sphere position="0 1 -20" radius="1.25" color="#EF2D5E"></a-sphere>
    </a-scene>
  </body>
</html>

The result of the adjustments can be seen below, but are shown loaded on my mobile browser.

Screenshot_2015-12-17-13-12-27

By clicking on the VR headset icon, the image is split into two screens which can now be viewed using a VR headset or Google Cardboard. This split screen functionality is already built into the script and will work on most mobile devices.

According to Mozilla, “A-Frame supports the Oculus Rift and mobile phones in “Cardboard”-style holders.” They do state that there are some issues with some Android devices but these problems are currently being addressed as a priority. I loaded the web page on my Galaxy 6 in Chrome and so far have not experienced any problems.

Screenshot_2015-12-17-13-12-16

The A-Frame website offers a decent set of documentation and a pretty impressive selection of basic examples of how the framework can be used, as well as the code. Be sure to check out the site using your mobile browser, which will give you a better idea of it’s potential. As far as features, there is currently support for 360 videos, fog, cameras, lighting and other basic 3D elements, with interactivity and animation support coming soon.

I really encourage you to go to the website and start experimenting with A-Frame. As web developers start kicking the tires and exploring it’s capabilities, I think we are about start seeing a whole new paradigm shift in web design. Exciting times!

Sean

Sean Earley is the Executive Editor of AR/VR Magazine, Virtual Reality Consultant at INSCALE, an author, blogger, musician, artist and virtual reality freak. He Loves coffee, guitars and making cool stuff.

You Might Be Interested In These: