-
Notifications
You must be signed in to change notification settings - Fork 0
/
interactievekaart.html
87 lines (68 loc) · 2.99 KB
/
interactievekaart.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<!doctype HTML>
<html>
<head>
<title>XR in aardrijkskunde</title>
</head>
<script src="js/aframe.min.js"></script>
<script src="js/aframe-ar.js"></script>
<script>
let markerVisible = { "KaartBelgieGemeentenTracker": false, "KaartBelgieGentTracker": false };
AFRAME.registerComponent('registerevents', {
init: function () {
let marker = this.el;
marker.addEventListener('markerFound', function () {
markerVisible[marker.id] = true;
console.log(markerVisible);
});
marker.addEventListener('markerLost', function () {
markerVisible[marker.id] = false;
console.log(markerVisible);
});
}
});
AFRAME.registerComponent('loop',
{
init: function()
{
this.plane1 = document.querySelector("#plane1");
this.plane2 = document.querySelector("#plane2");
},
tick: function (time, deltaTime)
{
// for convenience
let mv = markerVisible;
if ( mv["KaartBelgieGemeentenTracker"] )
this.plane1.setAttribute("scale", "2 2 2");
else if ( mv["KaartBelgieGemeentenTracker"] == false )
this.plane1.setAttribute("scale", "0 0 0");
if ( mv["KaartBelgieGentTracker"] )
this.plane2.setAttribute("scale", "2 2 2");
else if ( mv["KaartBelgieGentTracker"] == false )
this.plane2.setAttribute("scale", "0 0 0");
}
});
</script>
<body style="margin: 0px; overflow: hidden;">
<!-- set detectionMode and matrixCodeType to enable barcode marker detection and custom pattern files -->
<a-scene embedded vr-mode-ui="enabled: false;"
arjs="debugUIEnabled: false; detectionMode: mono_and_matrix; matrixCodeType: 3x3;">
<a-assets>
<img id="KaartBelgieBasis" src="images/KaartBelgieBasis.svg" />
<img id="KaartBelgieGemeenten" src="images/KaartBelgieGemeenten.svg" />
<img id="KaartBelgieGent" src="images/KaartBelgieGent.svg" />
</a-assets>
<a-marker type="barcode" value="0" id="baseMap" registerevents>
<a-plane id="plane0" position="0 0 0" rotation="-90 0 0" scale="2 2 2"
material="src: #KaartBelgieBasis;"></a-plane>
<a-plane id="plane1" position="0 0 0" rotation="-90 0 0" scale="0 0 0"
material="src: #KaartBelgieGemeenten; transparent: true;"></a-plane>
<a-plane id="plane2" position="0 0 0" rotation="-90 0 0" scale="0 0 0"
material="src: #KaartBelgieGent; transparent: true;"></a-plane>
</a-marker>
<a-marker type="barcode" value="1" id="KaartBelgieGemeentenTracker" registerevents></a-marker>
<a-marker type="barcode" value="2" id="KaartBelgieGentTracker" registerevents></a-marker>
<a-entity camera></a-entity>
<a-entity loop></a-entity>
</a-scene>
</body>
</html>