Skip to content

Instantly share code, notes, and snippets.

@ShanikaNishadhi
Created April 20, 2022 16:20
Show Gist options
  • Save ShanikaNishadhi/32da96a5f3ce1fffe7fcc9d35ef10430 to your computer and use it in GitHub Desktop.
Save ShanikaNishadhi/32da96a5f3ce1fffe7fcc9d35ef10430 to your computer and use it in GitHub Desktop.
<!-- Import A-Frame and AR.js libraries -->
<script src="https://cdn.jsdelivr.net/gh/aframevr/aframe@1c2407b26c61958baa93967b5412487cd94b290b/dist/aframe-master.min.js"></script>
<script src="https://raw.githack.com/AR-js-org/AR.js/master/aframe/build/aframe-ar-nft.js"></script>
<!-- Loading Screen Styles -->
<style>
.arjs-loader {
height: 100%;
width: 100%;
position: absolute;
top: 0;
left: 0;
background-color: rgba(0, 0, 0, 0.8);
z-index: 9999;
display: flex;
justify-content: center;
align-items: center;
}
.arjs-loader div {
text-align: center;
font-size: 1.25em;
color: white;
}
</style>
<body style="margin : 0px; overflow: hidden;">
<!-- Minimal Loader Description until the assets are loaded -->
<div class="arjs-loader">
<div>Loading, please wait...</div>
</div>
<!-- A-Frame Scene -->
<a-scene
vr-mode-ui="enabled: false;"
renderer="logarithmicDepthBuffer: true;"
embedded
arjs="trackingMethod: best; sourceType: webcam;debugUIEnabled: false;"
>
<!-- The NFT image used for Tracking -->
<a-nft
type="nft"
url="<Path to NTF Files>"
smooth="true"
smoothCount="10"
smoothTolerance=".01"
smoothThreshold="5"
>
<!-- Define the GLTF model -->
<a-entity
gltf-model="<Path to Model>"
scale="5 5 5"
position="50 150 0"
>
</a-entity>
</a-nft>
<!-- Create the Static Camera -->
<a-entity camera></a-entity>
</a-scene>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment