-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex2.html
43 lines (39 loc) · 1.68 KB
/
index2.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
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<script src="https://cdn.jsdelivr.net/gh/hiukim/[email protected]/dist/mindar-face.prod.js"></script>
<script src="https://aframe.io/releases/1.2.0/aframe.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/hiukim/[email protected]/dist/mindar-face-aframe.prod.js"></script>
<script src="https://html2canvas.hertzen.com/dist/html2canvas.min.js"></script>
<link rel="stylesheet" href="./media/css/main.css">
</head>
<body>
<a-scene mindar-face embedded vr-mode-ui="enabled: false" device-orientation-permission-ui="enabled: false">
<a-camera active="false" position="0 0 0"></a-camera>
<a-entity mindar-face-target="anchorIndex: 1">
<a-sphere color="green" radius="0.1"></a-sphere>
</a-entity>
</a-scene>
<button id="screenshotButton">
<img src="./media/img/camera.png" />
</button>
</body>
<footer>
<script>
document.getElementById('screenshotButton').addEventListener('click', function() {
console.log("screenshot button event - log");
this.classList.toggle('clicked'); // Toggle the 'clicked' class
html2canvas(document.querySelector('body')).then(canvas => {
const imageData = canvas.toDataURL('image/png');
const link = document.createElement('a');
link.href = imageData;
link.download = 'screenshot.png';
link.click();
console.log(link);
}).catch (error => {
console.log("Error taking screenshot: ", error);
});
});
</script>
</footer>
</html>