-
Notifications
You must be signed in to change notification settings - Fork 0
/
barcode.html
41 lines (32 loc) · 1.78 KB
/
barcode.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
<!doctype HTML>
<html>
<head>
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
</head>
<script src="https://aframe.io/releases/0.9.0/aframe.min.js"></script>
<script src="https://rawgit.com/jeromeetienne/AR.js/master/aframe/build/aframe-ar.min.js"></script>
<script src="https://rawgit.com/donmccurdy/aframe-extras/master/dist/aframe-extras.loaders.min.js"></script>
<body style='margin : 0px; overflow: hidden;'>
<!-- we add detectionMode and matrixCodeType to tell AR.js to recognize barcode markers -->
<a-scene embedded arjs='sourceType: webcam; debugUIEnabled: false; detectionMode: mono_and_matrix; matrixCodeType: 4x4;'>
<a-marker type='barcode' value='043'>
<a-box position='0 1 0' color="blue"></sphere>
</a-marker>
<a-marker type='barcode' value=’22’>
<a-box position='0 1 0' color="yellow"></a-box>
</a-marker>
<!-- use this <a-entity camera> to support multiple-markers, otherwise use <a-marker-camera> instead of </a-marker> -->
<a-entity camera></a-entity>
</a-scene>
</body>
</html>
Don’t worry if this looks scary. Notice the highlighted regions:
<a-marker type='barcode' value='99'>
This is used to identify barcodes for the value 99
<a-box position='0 1 0' color="yellow"></a-box>
Once the barcode has been identified, this line shows a box/cube of yellow color on top the barcode.
You can also show other shapes in place of a box:
<a-cone position='0 1 0' color="blue"></a-cone>
<a-cylinder position='0 1 0' color="blue"></a-cylinder>
<a-sphere position='0 1 0' color="blue"></a-sphere>
<a-tetrahedron position='0 1 0' color="blue"></a-tetrahedron>