-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
119 lines (99 loc) · 2.46 KB
/
Copy pathindex.html
File metadata and controls
119 lines (99 loc) · 2.46 KB
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>EchoFrame</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
<!-- A-Frame -->
<script src="https://aframe.io/releases/1.4.2/aframe.min.js"></script>
<!-- MindAR (Image Tracking) -->
<script src="https://cdn.jsdelivr.net/npm/mind-ar@1.2.5/dist/mindar-image-aframe.prod.js"></script>
<style>
body {
margin: 0;
overflow: hidden;
background: #000;
font-family: system-ui, sans-serif;
}
#ui {
position: fixed;
bottom: 16px;
width: 100%;
text-align: center;
color: white;
font-size: 14px;
z-index: 10;
text-shadow: 0 0 6px black;
pointer-events: none;
}
#loader {
position: fixed;
inset: 0;
background: #000;
display: flex;
align-items: center;
justify-content: center;
color: white;
font-size: 16px;
z-index: 20;
}
</style>
</head>
<body>
<!-- Loading overlay -->
<div id="loader">Loading EchoFrame…</div>
<!-- Hint text -->
<div id="ui">📸 Point your camera at the EchoFrame photo</div>
<a-scene
mindar-image="imageTargetSrc: targets.mind;"
vr-mode-ui="enabled: false"
device-orientation-permission-ui="enabled: false"
renderer="antialias: true; alpha: true;"
>
<!-- Assets -->
<a-assets>
<video
id="memoryVideo"
src="assets/memory.mp4"
preload="auto"
loop
playsinline
webkit-playsinline
crossorigin="anonymous"
></video>
</a-assets>
<!-- Camera -->
<a-camera
position="0 0 0"
look-controls="enabled: false"
></a-camera>
<!-- Image Target -->
<a-entity mindar-image-target="targetIndex: 0">
<!-- Video overlay (match your photo aspect ratio) -->
<a-video
src="#memoryVideo"
width="1.1"
height="1.1"
position="0 0 0"
></a-video>
</a-entity>
</a-scene>
<script>
const video = document.getElementById("memoryVideo");
const loader = document.getElementById("loader");
const scene = document.querySelector("a-scene");
// Hide loader when AR is ready
scene.addEventListener("renderstart", () => {
loader.style.display = "none";
});
// Play video when photo is detected
scene.addEventListener("targetFound", () => {
video.play();
});
// Pause when photo is lost
scene.addEventListener("targetLost", () => {
video.pause();
});
</script>
</body>
</html>