<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Matt Bibby</title>
    <description>The latest articles on DEV Community by Matt Bibby (@bibby).</description>
    <link>https://dev.to/bibby</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F227622%2F947042f0-873d-45a5-93b7-bf3c5087c9e7.jpg</url>
      <title>DEV Community: Matt Bibby</title>
      <link>https://dev.to/bibby</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/bibby"/>
    <language>en</language>
    <item>
      <title>AR For The Web: An 8th Wall Tutorial</title>
      <dc:creator>Matt Bibby</dc:creator>
      <pubDate>Wed, 11 Sep 2019 18:58:20 +0000</pubDate>
      <link>https://dev.to/bibby/ar-for-the-web-an-8th-wall-tutorial-3be7</link>
      <guid>https://dev.to/bibby/ar-for-the-web-an-8th-wall-tutorial-3be7</guid>
      <description>&lt;h1&gt;
  
  
  AR For the Web
&lt;/h1&gt;

&lt;p&gt;Hi everyone, I'm a dev that's very interested in XR technology, and I think it would be great if users didn't need an expensive phone or a fancy headset to experience XR for themselves.&lt;br&gt;
In this set of tutorials, I'll be walking you through how to create your own Augmented reality app using 8th Wall and A-Frame, that you can run right in your phone browser! I'll try to take it slow, so even if you have little experience you should still be able to follow along!&lt;/p&gt;
&lt;h2&gt;
  
  
  Pre-Requisites
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;We'll need NPM to install the packages we need in order to run our app. &lt;a href="https://www.npmjs.com/get-npm" rel="noopener noreferrer"&gt;https://www.npmjs.com/get-npm&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;A text editor, my personal preference is VSCode &lt;a href="https://code.visualstudio.com/" rel="noopener noreferrer"&gt;https://code.visualstudio.com/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;A web dev account on 8th Wall ( Important to choose web dev not unity for this tutorial ) &lt;a href="https://www.8thwall.com/" rel="noopener noreferrer"&gt;https://www.8thwall.com/&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Let's Start : Setting Up
&lt;/h2&gt;

&lt;p&gt;Before we dive in I'll make a note to say that this tutorial will mostly follow the 8th wall quick start docs, so if you need another perspective head there. The following tutorials will dive deeper.&lt;br&gt;&lt;br&gt;
First let's navigate to our 8th wall console (&lt;a href="https://console.8thwall.com/web/" rel="noopener noreferrer"&gt;https://console.8thwall.com/web/&lt;/a&gt;), and create a new project. Our console should look like so: &lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FoZxJ00U.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FoZxJ00U.png" alt="Web console with one project"&gt;&lt;/a&gt;&lt;br&gt;
Next we need to authorize our phone as a developer device. To do this just click device authorization in the top right of the developer console, and scan the QR code.&lt;br&gt;&lt;br&gt;
Now we'll download some scripts that will allow us to run our future AR app locally. We can clone or download the following repo for the scripts: &lt;/p&gt;
&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/8thwall" rel="noopener noreferrer"&gt;
        8thwall
      &lt;/a&gt; / &lt;a href="https://github.com/8thwall/web" rel="noopener noreferrer"&gt;
        web
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      8th Wall Web projects and resources.
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;8th Wall Web&lt;/h1&gt;

&lt;/div&gt;
&lt;p&gt;8th Wall Web: WebAR for mobile devices!&lt;/p&gt;
&lt;p&gt;Built entirely using standards-compliant JavaScript and WebGL, 8th Wall Web is a complete implementation of 8th Wall’s Simultaneous Localization and Mapping (SLAM) engine, hyper-optimized for real-time AR on mobile browsers. Features include World Tracking, Image Targets, Face Effects, Lightship Visual Positioning System (VPS), Sky Effects, Hand Tracking, and more.&lt;/p&gt;

&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;Resources&lt;/h1&gt;

&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.8thwall.com/docs/guides/advanced-topics/local-hosting#getting-started" rel="nofollow noopener noreferrer"&gt;Getting Started Guide&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.8thwall.com/docs/guides/advanced-topics/local-hosting#serve-projects-over-https" rel="nofollow noopener noreferrer"&gt;Serving projects over HTTPS&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.8thwall.com/docs/web/" rel="nofollow noopener noreferrer"&gt;Documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.8thwall.com" rel="nofollow noopener noreferrer"&gt;8th Wall Website&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;Examples&lt;/h1&gt;

&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://github.com/8thwall/web/tree/master/examples/aframe" rel="noopener noreferrer"&gt;A-Frame Examples&lt;/a&gt; (Recommended to start)&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/8thwall/web/tree/master/examples/babylonjs" rel="noopener noreferrer"&gt;Babylon.js Examples&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/8thwall/web/tree/master/examples/threejs" rel="noopener noreferrer"&gt;three.js Examples&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/8thwall/web/tree/master/examples/camerapipeline" rel="noopener noreferrer"&gt;Camera Pipeline Examples&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;



&lt;/div&gt;
&lt;br&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/8thwall/web" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;br&gt;
&lt;/div&gt;
&lt;br&gt;
 In this tutorial we'll just get the zip since we don't need all of the files.&lt;br&gt;&lt;br&gt;
Let's grab the serve folder from the zip, and set up an empty folder that we will serve our application from.&lt;br&gt;&lt;br&gt;
Inside our empty folder let's create a new HMTL file called index.html  

&lt;p&gt;Here's what my folder structure looks like:&lt;br&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FY3G93vv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FY3G93vv.png" alt="Folder Structure"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Inside this file we will import scripts to enable our A-Frame and 8th wall content. We will also set up our application key. Our index page should look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;html&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;charset=&lt;/span&gt;&lt;span class="s"&gt;"utf-8"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;title&amp;gt;&lt;/span&gt;My First Web-AR App!&lt;span class="nt"&gt;&amp;lt;/title&amp;gt;&lt;/span&gt;

    &lt;span class="c"&gt;&amp;lt;!-- This is 8th Wall's version of A-Frame --&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;script &lt;/span&gt;&lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"//cdn.8thwall.com/web/aframe/8frame-0.8.2.min.js"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;

    &lt;span class="c"&gt;&amp;lt;!-- This allows us some nice 8th wall AR extras such as the tap to recenter and a loading spinner --&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;script &lt;/span&gt;&lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"//cdn.8thwall.com/web/xrextras/xrextras.js"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;

    &lt;span class="c"&gt;&amp;lt;!-- We need to replace the XXXXXXXX here with our AppKey --&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;script &lt;/span&gt;&lt;span class="na"&gt;async&lt;/span&gt; &lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"//apps.8thwall.com/xrweb?appKey=XXXXXXXX"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;

  &lt;span class="nt"&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;

  &lt;span class="nt"&gt;&amp;lt;body&amp;gt;&lt;/span&gt;

  &lt;span class="nt"&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;

&lt;span class="nt"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;We need to import our appkey, so let's head back to the web console. Our App key will be on the right inside our project panel. Just copy and paste this key to replace the Xs in our Index file.&lt;/p&gt;
&lt;h2&gt;
  
  
  Creating Our Content
&lt;/h2&gt;

&lt;p&gt;In order to include our AR content we will be using A-Frame. This three.js framework allows us to declaratively add 3d objects to our scene and interact with them using an entity component architecture. In my opinion working with A-Frame feels similar to working with Unity and allows quick prototyping and development. A-Frame is created by Mozilla, the docs can be found here: &lt;a href="https://aframe.io/docs/0.9.0/introduction/" rel="noopener noreferrer"&gt;https://aframe.io/docs/0.9.0/introduction/&lt;/a&gt;.&lt;br&gt;&lt;br&gt;
Let's start by adding our first &lt;strong&gt;entity&lt;/strong&gt; to our application; the a-scene. We'll insert it into our body tag just like regular HTML. You might notice we have some attributes on this tag, these are custom 8th wall &lt;strong&gt;components&lt;/strong&gt; which have mostly self-explanatory names.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;body&amp;gt;&lt;/span&gt;

    &lt;span class="nt"&gt;&amp;lt;a-scene&lt;/span&gt;
        &lt;span class="na"&gt;xrweb&lt;/span&gt;
        &lt;span class="na"&gt;xrextras-tap-recenter&lt;/span&gt;
        &lt;span class="na"&gt;xrextras-almost-there&lt;/span&gt;
        &lt;span class="na"&gt;xrextras-loading&lt;/span&gt;
        &lt;span class="na"&gt;xrextras-runtime-error&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;

    &lt;span class="nt"&gt;&amp;lt;/a-scene&amp;gt;&lt;/span&gt;

&lt;span class="nt"&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Now we have our a-scene setup we can insert more &lt;strong&gt;entities&lt;/strong&gt; to our application. Nested inside our a-scene let's add a camera and some lights so we can see what we are doing.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;body&amp;gt;&lt;/span&gt;

    &lt;span class="nt"&gt;&amp;lt;a-scene&lt;/span&gt;
        &lt;span class="na"&gt;xrweb&lt;/span&gt;
        &lt;span class="na"&gt;xrextras-tap-recenter&lt;/span&gt;
        &lt;span class="na"&gt;xrextras-almost-there&lt;/span&gt;
        &lt;span class="na"&gt;xrextras-loading&lt;/span&gt;
        &lt;span class="na"&gt;xrextras-runtime-error&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;

        &lt;span class="nt"&gt;&amp;lt;a-camera&lt;/span&gt; &lt;span class="na"&gt;position=&lt;/span&gt;&lt;span class="s"&gt;"0 8 8"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/a-camera&amp;gt;&lt;/span&gt;

        &lt;span class="nt"&gt;&amp;lt;a-entity&lt;/span&gt;
            &lt;span class="na"&gt;light=&lt;/span&gt;&lt;span class="s"&gt;"type: directional;
                castShadow: true;
                intensity: 0.8;
                shadowCameraTop: 7;
                shadowMapHeight: 1024;
                shadowMapWidth: 1024;"&lt;/span&gt;
            &lt;span class="na"&gt;position=&lt;/span&gt;&lt;span class="s"&gt;"1 4.3 2.5"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;/a-entity&amp;gt;&lt;/span&gt;

        &lt;span class="nt"&gt;&amp;lt;a-entity&lt;/span&gt;
            &lt;span class="na"&gt;light=&lt;/span&gt;&lt;span class="s"&gt;"type: directional; castShadow: false; intensity: 0.5;"&lt;/span&gt;
            &lt;span class="na"&gt;position=&lt;/span&gt;&lt;span class="s"&gt;"-0.8 3 1.85"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;/a-entity&amp;gt;&lt;/span&gt;

        &lt;span class="nt"&gt;&amp;lt;a-light&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"ambient"&lt;/span&gt; &lt;span class="na"&gt;intensity=&lt;/span&gt;&lt;span class="s"&gt;"0.2"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/a-light&amp;gt;&lt;/span&gt;

    &lt;span class="nt"&gt;&amp;lt;/a-scene&amp;gt;&lt;/span&gt;

&lt;span class="nt"&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;First we added the &lt;code&gt;&amp;lt;a-camera&amp;gt;&lt;/code&gt; to the scene, this is one of a number of primitive &lt;strong&gt;entities&lt;/strong&gt; that A-Frame provides ( &lt;a href="https://aframe.io/docs/0.9.0/introduction/html-and-primitives.html#primitives" rel="noopener noreferrer"&gt;more info here&lt;/a&gt; ). Our camera also has a position &lt;strong&gt;component&lt;/strong&gt; that we can provide arguments to. While using A-Frame you will make use of many components, they provide a lot of functionality to our &lt;strong&gt;entities&lt;/strong&gt; such as; position, scale, materials and more. Without our components our entities would be nothing!&lt;br&gt;&lt;br&gt;
We then added some more &lt;strong&gt;entities&lt;/strong&gt; to our scene, each with a light and position &lt;strong&gt;component&lt;/strong&gt; and a number of arguments. Hopefully now you have the general gist of working A-Frame's &lt;strong&gt;Entity&lt;/strong&gt; &lt;strong&gt;Component&lt;/strong&gt; system, these are the building blocks with which we can build anything!&lt;br&gt;&lt;br&gt;
Lastly we added an &lt;code&gt;&amp;lt;a-light&amp;gt;&lt;/code&gt; another A-Frame primitive, I'm sure you can guess what this one does!&lt;br&gt;&lt;br&gt;
Ok. Now let's add something to our scene that we can actually see, we'll start simple, with a box perhaps. Inserted underneath our light entity:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;a-box&lt;/span&gt; 
    &lt;span class="na"&gt;color=&lt;/span&gt;&lt;span class="s"&gt;"blue"&lt;/span&gt; 
    &lt;span class="na"&gt;depth=&lt;/span&gt;&lt;span class="s"&gt;"2"&lt;/span&gt; 
    &lt;span class="na"&gt;height=&lt;/span&gt;&lt;span class="s"&gt;"2"&lt;/span&gt; 
    &lt;span class="na"&gt;width=&lt;/span&gt;&lt;span class="s"&gt;"3"&lt;/span&gt;
    &lt;span class="na"&gt;position=&lt;/span&gt;&lt;span class="s"&gt;"0 0 2"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/a-box&amp;gt;&lt;/span&gt;

&lt;span class="nt"&gt;&amp;lt;a-entity&lt;/span&gt;
    &lt;span class="na"&gt;geometry=&lt;/span&gt;&lt;span class="s"&gt;"primitive: box; width: 1; height: 1; depth: 1"&lt;/span&gt;
    &lt;span class="na"&gt;material=&lt;/span&gt;&lt;span class="s"&gt;"color: yellow"&lt;/span&gt;
    &lt;span class="na"&gt;position=&lt;/span&gt;&lt;span class="s"&gt;"-0.8 1.2 2"&lt;/span&gt;
    &lt;span class="na"&gt;rotation=&lt;/span&gt;&lt;span class="s"&gt;"0 45 0"&lt;/span&gt;
    &lt;span class="na"&gt;scale=&lt;/span&gt;&lt;span class="s"&gt;"0.5 0.5 0.5"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/a-entity&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;So we added two boxes in two different ways!&lt;br&gt;&lt;br&gt;
The first uses the primitive entity &lt;code&gt;&amp;lt;a-box&amp;gt;&lt;/code&gt; and we've given it some components to change the look and notably the position. Position in A-Frame is controlled similarly to Unity's Vector3 struct. We can give it 3 arguments; the x,y,z coordinates of our object in 3D space.&lt;br&gt;&lt;br&gt;
Next we opted for the basic entity option, and added a geometry component to show our box. We also added some other components here, such as scale and rotation. For a list of all built in components it's a good plan to check the &lt;a href="https://aframe.io/docs/0.9.0/core/component.html" rel="noopener noreferrer"&gt;A-Frame docs!&lt;/a&gt;&lt;br&gt;&lt;br&gt;
Our whole index file should look like this:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;html&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;charset=&lt;/span&gt;&lt;span class="s"&gt;"utf-8"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;title&amp;gt;&lt;/span&gt;My First Web-AR App!&lt;span class="nt"&gt;&amp;lt;/title&amp;gt;&lt;/span&gt;

    &lt;span class="c"&gt;&amp;lt;!-- This is 8th Wall's version of Aframe --&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;script &lt;/span&gt;&lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"//cdn.8thwall.com/web/aframe/8frame-0.8.2.min.js"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;

    &lt;span class="c"&gt;&amp;lt;!-- This allows us some nice 8th wall AR extras such as the tap to recenter and a loading spinner --&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;script &lt;/span&gt;&lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"//cdn.8thwall.com/web/xrextras/xrextras.js"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;

    &lt;span class="c"&gt;&amp;lt;!-- We need to replace the XXXXXXXX here with our AppKey --&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;script &lt;/span&gt;&lt;span class="na"&gt;async&lt;/span&gt; &lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"//apps.8thwall.com/xrweb?appKey=76ZXfqUXU4WjzcF3j3COyqxdgylAbcbSnHqyfHXo7IWmeJWSgkxOveZy93cPbQERsXsG5C"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;

  &lt;span class="nt"&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;

  &lt;span class="nt"&gt;&amp;lt;body&amp;gt;&lt;/span&gt;

    &lt;span class="nt"&gt;&amp;lt;a-scene&lt;/span&gt;
      &lt;span class="na"&gt;xrweb&lt;/span&gt;
      &lt;span class="na"&gt;xrextras-tap-recenter&lt;/span&gt;
      &lt;span class="na"&gt;xrextras-almost-there&lt;/span&gt;
      &lt;span class="na"&gt;xrextras-loading&lt;/span&gt;
      &lt;span class="na"&gt;xrextras-runtime-error&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;

        &lt;span class="nt"&gt;&amp;lt;a-camera&lt;/span&gt; &lt;span class="na"&gt;position=&lt;/span&gt;&lt;span class="s"&gt;"0 8 8"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/a-camera&amp;gt;&lt;/span&gt;

        &lt;span class="nt"&gt;&amp;lt;a-entity&lt;/span&gt;
        &lt;span class="na"&gt;light=&lt;/span&gt;&lt;span class="s"&gt;"type: directional;
            castShadow: true;
            intensity: 0.8;
            shadowCameraTop: 7;
            shadowMapHeight: 1024;
            shadowMapWidth: 1024;"&lt;/span&gt;
        &lt;span class="na"&gt;position=&lt;/span&gt;&lt;span class="s"&gt;"1 4.3 2.5"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;/a-entity&amp;gt;&lt;/span&gt;

        &lt;span class="nt"&gt;&amp;lt;a-entity&lt;/span&gt;
        &lt;span class="na"&gt;light=&lt;/span&gt;&lt;span class="s"&gt;"type: directional; castShadow: false; intensity: 0.5;"&lt;/span&gt;
        &lt;span class="na"&gt;position=&lt;/span&gt;&lt;span class="s"&gt;"-0.8 3 1.85"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;/a-entity&amp;gt;&lt;/span&gt;

        &lt;span class="nt"&gt;&amp;lt;a-light&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"ambient"&lt;/span&gt; &lt;span class="na"&gt;intensity=&lt;/span&gt;&lt;span class="s"&gt;"0.2"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/a-light&amp;gt;&lt;/span&gt;

        &lt;span class="nt"&gt;&amp;lt;a-box&lt;/span&gt; 
        &lt;span class="na"&gt;color=&lt;/span&gt;&lt;span class="s"&gt;"blue"&lt;/span&gt; 
        &lt;span class="na"&gt;depth=&lt;/span&gt;&lt;span class="s"&gt;"2"&lt;/span&gt; 
        &lt;span class="na"&gt;height=&lt;/span&gt;&lt;span class="s"&gt;"2"&lt;/span&gt; 
        &lt;span class="na"&gt;width=&lt;/span&gt;&lt;span class="s"&gt;"3"&lt;/span&gt;
        &lt;span class="na"&gt;position=&lt;/span&gt;&lt;span class="s"&gt;"0 0 2"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;/a-box&amp;gt;&lt;/span&gt;

        &lt;span class="nt"&gt;&amp;lt;a-entity&lt;/span&gt;
        &lt;span class="na"&gt;geometry=&lt;/span&gt;&lt;span class="s"&gt;"primitive: box; width: 1; height: 1; depth: 1"&lt;/span&gt;
        &lt;span class="na"&gt;material=&lt;/span&gt;&lt;span class="s"&gt;"color: yellow"&lt;/span&gt;
        &lt;span class="na"&gt;position=&lt;/span&gt;&lt;span class="s"&gt;"-0.8 1.2 2"&lt;/span&gt;
        &lt;span class="na"&gt;rotation=&lt;/span&gt;&lt;span class="s"&gt;"0 45 0"&lt;/span&gt;
        &lt;span class="na"&gt;scale=&lt;/span&gt;&lt;span class="s"&gt;"0.5 0.5 0.5"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;/a-entity&amp;gt;&lt;/span&gt;

    &lt;span class="nt"&gt;&amp;lt;/a-scene&amp;gt;&lt;/span&gt;

  &lt;span class="nt"&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;

&lt;span class="nt"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h2&gt;
  
  
  Running Our App
&lt;/h2&gt;

&lt;p&gt;In order to run our app locally we'll use the serve script we downloaded earlier.  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Open a terminal window and navigate to your project folder.&lt;/li&gt;
&lt;li&gt;navigate into the serve folder:
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd serve
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;Install the required node modules:
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;Go back to the project folder:
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd ..
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;Run the serve script:
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Windows : 
    serve\bin\serve.bat -d {MyProjectName}
MacOS :
    ./serve/bin/serve -d ./{MyProjectName}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;Scan the QR on your mobile, and proceed past the security warning (It's our app so it's fine). You'll also have to give camera permissions to the browser.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You should now be able to see your app up and running!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FuOl6GTo.png%3F1" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FuOl6GTo.png%3F1" alt="AR Boxes!"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It might not look like much, but we've created our first AR Web App! And all great things must start somewhere!  &lt;/p&gt;

&lt;p&gt;Once again I'd recommend taking a look at &lt;a href="https://aframe.io/docs/0.9.0/core/component.htm" rel="noopener noreferrer"&gt;the docs&lt;/a&gt; to see what other kind of primitives we can use to make something cool in our scene using just the basics.&lt;/p&gt;

&lt;p&gt;I hope you enjoyed this look at 8th Wall and A-Frame. If there is interest I'll continue with this series and cover importing custom models ( No more boxes! ) as well as using some animations and interactions.&lt;/p&gt;

&lt;p&gt;The final code is available here:&lt;br&gt;&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/mattbibby95" rel="noopener noreferrer"&gt;
        mattbibby95
      &lt;/a&gt; / &lt;a href="https://github.com/mattbibby95/ARWebTut" rel="noopener noreferrer"&gt;
        ARWebTut
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      An 8th Wall + Aframe Tutorial
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;This is the code from my 8th wall web app tutorial on Dev.to!&lt;/h1&gt;

&lt;/div&gt;

&lt;/div&gt;
&lt;br&gt;
&lt;br&gt;
  &lt;/div&gt;
&lt;br&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/mattbibby95/ARWebTut" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;br&gt;
&lt;/div&gt;
&lt;br&gt;


</description>
      <category>augmentedreality</category>
      <category>ar</category>
      <category>webdev</category>
      <category>html</category>
    </item>
  </channel>
</rss>
