Skip to content

Commit 72b7207

Browse files
example with loader page untile user has allowed camera access
1 parent 0f5725b commit 72b7207

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

aframe/examples/loader/index.html

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<!-- include a-frame -->
2+
<script src="https://cdn.jsdelivr.net/gh/aframevr/aframe@1c2407b26c61958baa93967b5412487cd94b290b/dist/aframe-master.min.js"></script>
3+
4+
<!-- include ar.js for aframe -->
5+
<script src='../../build/aframe-ar.js'></script>
6+
<script>ARjs.Context.baseURL = '../../../three.js/'</script>
7+
<script src="./index.js"></script>
8+
9+
<!-- start the body of your page -->
10+
<body>
11+
<div class="loader" style="width: 100%; height: 100%; position: absolute; z-index: 9999; top: 0; left: 0; display: flex; justify-content: flex-start;">
12+
<div class="loader-text" style="text-align: center;">
13+
Click on 'Allow' to start the Augmented Reality experience
14+
</div>
15+
</div>
16+
17+
<!-- Define your 3d scene and enabled ar.js -->
18+
<a-scene embedded arjs='debugUIEnabled: false; trackingMethod: best; sourceWidth:1280; sourceHeight:960; displayWidth: 1280; displayHeight: 960;'>
19+
20+
<!-- Create a anchor to attach your augmented reality -->
21+
<a-anchor hit-testing-enabled='true'>
22+
23+
<!-- Add your augmented reality here -->
24+
<a-box position='0 0.5 0' material='opacity: 0.5; side:double; color:red;'>
25+
<a-torus-knot radius='0.26' radius-tubular='0.05'
26+
animation="property: rotation; to:360 0 0; dur: 5000; easing: linear; loop: true">
27+
</a-torus-knot>
28+
</a-box>
29+
30+
</a-anchor>
31+
32+
<!-- Define a static camera -->
33+
<a-camera-static/>
34+
35+
</a-scene>
36+
</body>

aframe/examples/loader/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
window.onload = function (params) {
2+
window.addEventListener('camera-init', function() {
3+
document.querySelector('.loader').remove();
4+
});
5+
};

0 commit comments

Comments
 (0)