-
Notifications
You must be signed in to change notification settings - Fork 70
/
text-2D.html
70 lines (55 loc) · 1.35 KB
/
text-2D.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
58
59
60
61
62
63
64
65
66
67
68
69
70
<!DOCTYPE html>
<html>
<head>
<title>A-Frame - 2D Text</title>
<script src="js/aframe-master-v1.3.0.min.js"></script>
</head>
<body>
<script>
AFRAME.registerComponent('updater', {
init: function()
{
this.num = 0;
},
tick: function (time, timeDelta)
{
this.num += 1;
this.el.setAttribute("text", "value", "Tick counter: " + this.num)
}
});
</script>
<a-scene antialias="true">
<a-assets>
<img id="grid" src="images/border.png" crossorigin="anonymous" />
<img id="sky" src="images/stars.jpg" crossorigin="anonymous" />
</a-assets>
<a-sky
color = "#FFFFFF"
material = "src: #sky">
</a-sky>
<a-plane
width="100" height="100"
position=" 0.00 0.00 0.00"
rotation="-90 0 0"
color="#888888"
material="src: #grid; repeat:100 100; transparent: true; opacity: 0.75"
shadow="cast: false; receive: true">
</a-plane>
<!--
Notes on text object -
* width: width of line
* wrapCount: how many characters (approx) should fit into the width. Affects the font size.
-->
<a-entity
id="textArea"
position="0 1.5 -2"
geometry="primitive: plane; width: 3; height:auto"
material="color: #444444; transparent: true; opacity: 0.80;"
text="anchor: center; baseline: center; wrapCount: 20;
transparent: true; opacity: 0.90; color: #AAAAFF;
value: Tick Counter: ???"
updater>
</a-entity>
</a-scene>
</body>
</html>