-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathAR-render-html-simple.html
57 lines (50 loc) · 1.75 KB
/
AR-render-html-simple.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<title>WebAR: Render HTML sederhana</title>
<script src="./js/aframe/aframe.min.js"></script>
<script src="./js/arjs/aframe-ar.js"></script>
<script src="./js/aframe/aframe-html-shader.min.js"></script>
<style type="text/css">
#target {
width: 512px;
height: 512px;
position: absolute;
background: rgba(200, 55, 5, 0.7);
padding: 6em;
}
/* Hide the HTML using z-index. */
/* Can't use display: none because that would hide the HTML in the rendered material. */
#htmlTarget.hide {
z-index: -10;
}
#htmlTarget {
position: absolute;
z-index: 1;
height: 100%;
width: 100%;
overflow: hidden;
position: fixed;
top: 0;
}
</style>
</head>
<body style="margin : 0px; overflow: hidden;">
<a-scene embedded arjs update-html>
<a-anchor>
<!-- Letters. -->
<a-entity id="pageEntity" geometry="primitive: plane; width: 3; height: 3" rotation="-90 0 0" position="0 0.1 0" material="shader: html; target: #target; transparent: true; ratio: width; fps: 1.5"></a-entity>
<!-- HTML to render as a material. -->
<div id="htmlTarget" class="hide">
<div id="target">
<h1>HELLO<span>★</span></h1>
<span id="pre">A</span>
</div>
</div>
</a-anchor>
<a-entity camera></a-entity>
</a-scene>
</body>
</html>