-
Notifications
You must be signed in to change notification settings - Fork 67
/
Copy pathtext.html
56 lines (40 loc) · 2.04 KB
/
text.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
<!doctype HTML>
<html>
<link rel="icon" href="data:;base64,iVBORw0KGgo=">
<script src="js/aframe.min.js"></script>
<script src="js/aframe-ar.js"></script>
<!-- support 3D text -->
<script src="js/aframe-text-geometry-component.min.js"></script>
<body style="margin: 0px; overflow: hidden;">
<a-scene embedded vr-mode-ui="enabled: false;" arjs="debugUIEnabled: false;">
<a-assets>
<a-asset-item id="exoFont" src="fonts/exoBlack.typeface.json"></a-asset-item>
<img id="pixels" src="images/pixels.png" />
</a-assets>
<!-- 2D text -->
<a-marker type="pattern" url="data/kanji.patt">
<!-- positioning a plane directly below text for increased visibility; need to adjust position to avoid z-fighting. -->
<a-plane color="white" rotation="-90 0 0" position="0 -0.25 0" width="3" material="transparent: true; opacity: 0.90"></a-plane>
<!-- for more properties, see https://github.com/aframevr/aframe/blob/master/docs/components/text.md -->
<a-text value="Hello, world!" font="fonts/Exo2Bold.fnt" color="red" rotation="-90 0 0" align="center" scale="2 2 2"></a-text>
<!-- positioning a second copy to attempt drop-shadow effect; need to adjust position to avoid z-fighting -->
<!-- <a-text value="Hello, world!" font="fonts/Exo2Bold.fnt" color="black" rotation="-90 0 0" align="center" scale="2 2 2" position="0.01 -0.2 0"></a-text> -->
<!-- avoiding z-fighting is difficult; may want to render canvas to text instead -->
</a-marker>
<!-- 3D text -->
<a-marker type="pattern" url="data/hiro.patt">
<!--
using aframe-text-geometry component
can set: bevelSize, bevelThickness, curveSegments, font, height, size, style, value.
alignment (centering) may be tricky; try calculating bounding box and repositioning.
for more info, see: https://www.npmjs.com/package/aframe-text-geometry-component
-->
<a-entity text-geometry="value: Hello, world!; font: #exoFont;"
material="color: yellow; src: #pixels; repeat: 0.5 0.5;"
rotation="-90 0 0">
</a-entity>
</a-marker>
<a-entity camera></a-entity>
</a-scene>
</body>
</html>