MatteoScript commited on
Commit
7b46bf4
·
verified ·
1 Parent(s): 07f2728

Rename index_old.html to ar.html

Browse files
Files changed (2) hide show
  1. ar.html +301 -0
  2. index_old.html +0 -280
ar.html ADDED
@@ -0,0 +1,301 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="it">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <!-- Viewport ottimizzato per mobile: blocco totale dello zoom e gestione notch -->
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover" />
7
+ <title>AR Neural Link | Vertical Native</title>
8
+
9
+ <!-- Tailwind & Fonts -->
10
+ <script src="https://cdn.tailwindcss.com"></script>
11
+ <link href="https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;700&display=swap" rel="stylesheet">
12
+
13
+ <!-- AR Libraries -->
14
+ <script src="https://aframe.io/releases/1.4.2/aframe.min.js"></script>
15
+ <script src="https://cdn.jsdelivr.net/npm/mind-ar@1.2.2/dist/mindar-image.prod.js"></script>
16
+ <script src="https://cdn.jsdelivr.net/npm/mind-ar@1.2.2/dist/mindar-image-aframe.prod.js"></script>
17
+
18
+ <style>
19
+ :root {
20
+ --neon-green: #00ff41;
21
+ --dark-bg: #050505;
22
+ --error-red: #ff0055;
23
+ }
24
+
25
+ /* Reset totale per comportamento "App Nativa" */
26
+ html, body {
27
+ margin: 0;
28
+ padding: 0;
29
+ width: 100%;
30
+ height: 100%;
31
+ background-color: transparent !important; /* Importante per vedere la camera */
32
+ font-family: 'Fira Code', monospace;
33
+ overflow: hidden; /* Blocca scroll elastico su iOS */
34
+ position: fixed; /* Blocca il body in posizione */
35
+ }
36
+
37
+ /* --- ENGINE GRAFICO (Camera e Canvas) --- */
38
+
39
+ /* 1. Video Webcam: Forziamo il riempimento verticale */
40
+ video {
41
+ position: absolute !important;
42
+ top: 0; left: 0; right: 0; bottom: 0;
43
+ width: 100% !important;
44
+ height: 100% !important;
45
+ object-fit: cover !important; /* Questo è il segreto per il full screen 9:16 */
46
+ z-index: -2 !important;
47
+ }
48
+
49
+ /* 2. Canvas AR: Sovrapposto perfettamente */
50
+ .a-canvas {
51
+ width: 100% !important;
52
+ height: 100% !important;
53
+ position: absolute !important;
54
+ top: 0; left: 0;
55
+ z-index: -1 !important;
56
+ }
57
+
58
+ /* FX: Scanlines (Ottimizzate per mobile) */
59
+ .scanlines {
60
+ background: linear-gradient(to bottom, rgba(255,255,255,0), rgba(255,255,255,0) 50%, rgba(0,0,0,0.2) 50%, rgba(0,0,0,0.2));
61
+ background-size: 100% 4px;
62
+ position: fixed; inset: 0; pointer-events: none;
63
+ z-index: 10;
64
+ opacity: 0.4;
65
+ }
66
+
67
+ /* UI Elements */
68
+ .tech-border {
69
+ border: 1px solid var(--neon-green);
70
+ box-shadow: 0 0 15px rgba(0, 255, 65, 0.15);
71
+ background: rgba(0,0,0,0.85);
72
+ backdrop-filter: blur(8px);
73
+ }
74
+
75
+ .a-enter-vr-button { display: none !important; }
76
+
77
+ /* --- LOADER STYLE --- */
78
+ #custom-loader {
79
+ position: fixed; inset: 0; z-index: 9999;
80
+ background: #000;
81
+ display: flex; flex-direction: column; align-items: center; justify-content: center;
82
+ transition: opacity 0.5s ease-out;
83
+ padding: 20px;
84
+ }
85
+
86
+ .glitch-text { animation: glitch 2s infinite; }
87
+ @keyframes glitch {
88
+ 0% { transform: translate(0); }
89
+ 20% { transform: translate(-2px, 2px); }
90
+ 40% { transform: translate(-2px, -2px); }
91
+ 60% { transform: translate(2px, 2px); }
92
+ 80% { transform: translate(2px, -2px); }
93
+ 100% { transform: translate(0); }
94
+ }
95
+
96
+ .loader-track {
97
+ width: 100%; max-width: 280px; height: 6px;
98
+ background: #111; margin-top: 20px;
99
+ overflow: hidden; border-radius: 4px;
100
+ }
101
+ .loader-fill {
102
+ height: 100%; background: var(--neon-green); width: 0%;
103
+ transition: width 0.3s;
104
+ box-shadow: 0 0 10px var(--neon-green);
105
+ }
106
+
107
+ /* Safe area per iPhone nuovi */
108
+ .safe-area-y {
109
+ padding-top: env(safe-area-inset-top, 20px);
110
+ padding-bottom: env(safe-area-inset-bottom, 20px);
111
+ }
112
+ </style>
113
+ </head>
114
+ <body>
115
+
116
+ <!-- 1. LOADER -->
117
+ <div id="custom-loader">
118
+ <div class="text-[#00ff41] text-5xl font-black tracking-tighter glitch-text mb-4">
119
+ LINK<br>START
120
+ </div>
121
+ <div class="text-white/50 text-xs font-mono uppercase tracking-[0.2em] mb-2">Initializing AR Core...</div>
122
+ <div class="loader-track"><div class="loader-fill" id="progress-bar"></div></div>
123
+ <div id="loading-percent" class="text-[#00ff41] font-mono text-xl mt-2 font-bold">0%</div>
124
+ </div>
125
+
126
+ <!-- 2. FX -->
127
+ <div class="scanlines"></div>
128
+
129
+ <!-- 3. UI LAYER (Vertical Native) -->
130
+ <div id="ui-layer" class="fixed inset-0 z-[50] flex flex-col justify-between safe-area-y pointer-events-none">
131
+
132
+ <!-- TOP HEADER -->
133
+ <div class="w-full px-6 py-4 flex justify-between items-center bg-gradient-to-b from-black/80 to-transparent pointer-events-auto">
134
+ <div class="flex flex-col">
135
+ <span class="text-[10px] text-white/60 font-mono tracking-widest">SYSTEM</span>
136
+ <span id="sys-status" class="text-[#00ff41] font-bold text-lg tracking-wider animate-pulse">SCANNING</span>
137
+ </div>
138
+ <a href="./index.html" class="w-10 h-10 flex items-center justify-center border border-[#00ff41]/50 rounded-full bg-black/40 backdrop-blur-md active:scale-95 transition-transform">
139
+ <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="#00ff41" stroke-width="2"><path d="M18 6L6 18M6 6l12 12"/></svg>
140
+ </a>
141
+ </div>
142
+
143
+ <!-- MIRINO (Adattato per Verticale) -->
144
+ <div id="aim-overlay" class="absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 flex flex-col items-center justify-center transition-opacity duration-300">
145
+ <!-- Frame Rettangolare Verticale (9:16 approx) -->
146
+ <div class="relative w-[65vw] h-[100vw] max-w-[300px] max-h-[500px] border border-white/20 rounded-xl">
147
+ <!-- Angoli Tech -->
148
+ <div class="absolute -top-1 -left-1 w-6 h-6 border-t-4 border-l-4 border-[#00ff41]"></div>
149
+ <div class="absolute -top-1 -right-1 w-6 h-6 border-t-4 border-r-4 border-[#00ff41]"></div>
150
+ <div class="absolute -bottom-1 -left-1 w-6 h-6 border-b-4 border-l-4 border-[#00ff41]"></div>
151
+ <div class="absolute -bottom-1 -right-1 w-6 h-6 border-b-4 border-r-4 border-[#00ff41]"></div>
152
+
153
+ <!-- Mirino centrale -->
154
+ <div class="absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-full flex items-center justify-center">
155
+ <div class="w-12 h-[1px] bg-[#00ff41]/50"></div>
156
+ <div class="h-12 w-[1px] bg-[#00ff41]/50 absolute"></div>
157
+ </div>
158
+ </div>
159
+ <div class="mt-4 bg-black/60 backdrop-blur px-4 py-2 rounded border border-[#00ff41]/30">
160
+ <p class="text-[#00ff41] text-xs font-bold tracking-widest uppercase">Inquadra il Marker</p>
161
+ </div>
162
+ </div>
163
+
164
+ <!-- BOTTOM CONTROLS -->
165
+ <div class="w-full px-6 pb-8 pointer-events-auto flex flex-col items-center bg-gradient-to-t from-black/90 to-transparent">
166
+ <!-- Pulsante Audio Enorme (Pollice friendly) -->
167
+ <button id="audio-btn" class="w-full max-w-sm py-5 bg-[#00ff41]/10 border border-[#00ff41] text-[#00ff41] font-bold text-lg uppercase tracking-[0.2em] rounded active:bg-[#00ff41] active:text-black transition-all mb-4 flex items-center justify-center gap-3 backdrop-blur-md">
168
+ <span>🔊</span>
169
+ <span id="audio-text">Attiva Audio</span>
170
+ </button>
171
+ <div class="text-[10px] text-white/40 font-mono">NEURAL_LINK v2.4.0 // VERTICAL_MODE</div>
172
+ </div>
173
+ </div>
174
+
175
+ <!-- 4. AR SCENE (VERTICAL SETUP) -->
176
+ <!-- Nota: missTolerance aumentato per mantenere il tracking più stabile mentre ci si muove -->
177
+ <a-scene
178
+ mindar-image="imageTargetSrc: img/targets.mind; filterMinCF:0.0001; filterBeta: 0.001; uiLoading: no; uiScanning: no; missTolerance: 10; warmupTolerance: 5"
179
+ color-space="sRGB"
180
+ renderer="colorManagement: true, physicallyCorrectLights, highRefreshRate: true"
181
+ vr-mode-ui="enabled: false"
182
+ device-orientation-permission-ui="enabled: false">
183
+
184
+ <a-assets>
185
+ <video id="vid" src="./img/video.mp4" preload="auto" loop muted playsinline webkit-playsinline crossorigin="anonymous"></video>
186
+ </a-assets>
187
+
188
+ <a-camera position="0 0 0" look-controls="enabled: false"></a-camera>
189
+
190
+ <a-entity id="example-target" mindar-image-target="targetIndex: 0">
191
+ <!--
192
+ GEOMETRIA VERTICALE (9:16)
193
+ Width: 1 (Largo quanto il target fisico)
194
+ Height: 1.777 (Proporzione 16:9 in verticale, cioè 1 * 16 / 9)
195
+ Questo forza il video ad apparire come uno schermo smartphone verticale fluttuante.
196
+ -->
197
+ <a-entity id="myVid"
198
+ geometry="primitive: plane; width: 1; height: 1.777"
199
+ material="src: #vid; shader: flat; transparent: true; opacity: 1"
200
+ position="0 0 0">
201
+ </a-entity>
202
+
203
+ <!-- Cornice Cyberpunk Verticale -->
204
+ <!-- Top Bar -->
205
+ <a-plane position="0 0.9 0" width="1.05" height="0.02" color="#00ff41" material="shader: flat"></a-plane>
206
+ <!-- Bottom Bar -->
207
+ <a-plane position="0 -0.9 0" width="1.05" height="0.02" color="#00ff41" material="shader: flat"></a-plane>
208
+ <!-- Left Bar -->
209
+ <a-plane position="-0.52 0 0" width="0.02" height="1.8" color="#00ff41" material="shader: flat"></a-plane>
210
+ <!-- Right Bar -->
211
+ <a-plane position="0.52 0 0" width="0.02" height="1.8" color="#00ff41" material="shader: flat"></a-plane>
212
+
213
+ <!-- Elementi decorativi agli angoli -->
214
+ <a-plane position="-0.52 0.9 0" width="0.1" height="0.02" color="white" material="shader: flat"></a-plane>
215
+ <a-plane position="0.52 -0.9 0" width="0.1" height="0.02" color="white" material="shader: flat"></a-plane>
216
+
217
+ </a-entity>
218
+ </a-scene>
219
+
220
+ <!-- 5. LOGIC -->
221
+ <script>
222
+ const video = document.querySelector("#vid");
223
+ const target = document.querySelector("#example-target");
224
+ const statusText = document.querySelector("#sys-status");
225
+ const aimOverlay = document.querySelector("#aim-overlay");
226
+ const audioBtn = document.querySelector("#audio-btn");
227
+ const audioText = document.querySelector("#audio-text");
228
+ const loader = document.querySelector("#custom-loader");
229
+ const loadingPercent = document.querySelector("#loading-percent");
230
+ const progressBar = document.querySelector("#progress-bar");
231
+ const scene = document.querySelector("a-scene");
232
+
233
+ let isAudioEnabled = false;
234
+ let loadProgress = 0;
235
+
236
+ // Simulazione caricamento rapido
237
+ const loadInterval = setInterval(() => {
238
+ loadProgress += 2;
239
+ if(loadProgress > 100) loadProgress = 100;
240
+ loadingPercent.innerText = loadProgress + "%";
241
+ progressBar.style.width = loadProgress + "%";
242
+
243
+ if(loadProgress >= 100) clearInterval(loadInterval);
244
+ }, 30);
245
+
246
+ // AR PRONTA
247
+ scene.addEventListener("arReady", () => {
248
+ console.log("AR System Ready");
249
+ // Chiudi loader
250
+ setTimeout(() => {
251
+ loader.style.opacity = "0";
252
+ setTimeout(() => loader.style.display = "none", 500);
253
+ }, 500);
254
+ });
255
+
256
+ // ERROR HANDLING
257
+ scene.addEventListener("arError", (ev) => {
258
+ alert("Errore fotocamera: controlla i permessi!");
259
+ });
260
+
261
+ // TARGET FOUND
262
+ target.addEventListener("targetFound", () => {
263
+ console.log("Found");
264
+ video.play();
265
+ statusText.innerText = "LOCKED";
266
+ statusText.style.color = "#fff";
267
+ statusText.classList.remove("animate-pulse");
268
+ aimOverlay.style.opacity = "0";
269
+ });
270
+
271
+ // TARGET LOST
272
+ target.addEventListener("targetLost", () => {
273
+ console.log("Lost");
274
+ video.pause();
275
+ statusText.innerText = "SEARCHING";
276
+ statusText.style.color = "#00ff41";
277
+ statusText.classList.add("animate-pulse");
278
+ aimOverlay.style.opacity = "1";
279
+ });
280
+
281
+ // AUDIO TOGGLE
282
+ audioBtn.addEventListener('click', () => {
283
+ if (!isAudioEnabled) {
284
+ video.muted = false;
285
+ isAudioEnabled = true;
286
+ audioText.innerText = "AUDIO ON";
287
+ audioBtn.classList.add("bg-[#00ff41]", "text-black");
288
+ audioBtn.classList.remove("bg-[#00ff41]/10", "text-[#00ff41]");
289
+
290
+ // Feedback aptico (vibrazione) se supportato
291
+ if(navigator.vibrate) navigator.vibrate(50);
292
+
293
+ setTimeout(() => {
294
+ audioBtn.style.opacity = "0";
295
+ audioBtn.style.pointerEvents = "none";
296
+ }, 1500);
297
+ }
298
+ });
299
+ </script>
300
+ </body>
301
+ </html>
index_old.html DELETED
@@ -1,280 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="it">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
6
- <title>AR Neural Link | MindAR</title>
7
-
8
- <!-- Tailwind & Fonts -->
9
- <script src="https://cdn.tailwindcss.com"></script>
10
- <link href="https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;700&display=swap" rel="stylesheet">
11
-
12
- <!-- AR Libraries -->
13
- <script src="https://aframe.io/releases/1.2.0/aframe.min.js"></script>
14
- <script src="https://cdn.jsdelivr.net/gh/hiukim/mind-ar-js@1.1.5/dist/mindar-image.prod.js"></script>
15
- <script src="https://cdn.jsdelivr.net/gh/hiukim/mind-ar-js@1.1.5/dist/mindar-image-aframe.prod.js"></script>
16
-
17
- <style>
18
- :root { --neon-green: #00ff41; --dark-bg: #050505; }
19
- body { margin: 0; background-color: black; font-family: 'Fira Code', monospace; overflow: hidden; }
20
-
21
- /* FX: Scanlines Overlay - RIDOTTO PER VISIBILITÀ VIDEO */
22
- .scanlines {
23
- background: linear-gradient(to bottom, rgba(255,255,255,0), rgba(255,255,255,0) 50%, rgba(0,0,0,0.1) 50%, rgba(0,0,0,0.1));
24
- background-size: 100% 4px;
25
- position: fixed; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 50;
26
- }
27
-
28
- /* FX: CRT Flicker */
29
- .crt-flicker { animation: flicker 0.15s infinite; pointer-events: none; position: fixed; inset: 0; background: rgba(0,255,65,0.01); z-index: 49;}
30
- @keyframes flicker { 0% { opacity: 0.95; } 50% { opacity: 1.0; } 100% { opacity: 0.95; } }
31
-
32
- /* UI Elements */
33
- .tech-border { border: 1px solid var(--neon-green); box-shadow: 0 0 10px rgba(0, 255, 65, 0.2); background: rgba(0,0,0,0.7); backdrop-filter: blur(4px); }
34
- .blinking-cursor { animation: blink 1s step-end infinite; }
35
- @keyframes blink { 50% { opacity: 0; } }
36
-
37
- /* Hide VR Button */
38
- .a-enter-vr-button { display: none !important; }
39
-
40
- /* --- STILI NUOVA BARRA DI CARICAMENTO --- */
41
- #custom-loader {
42
- position: fixed; inset: 0; z-index: 9999; background: #000;
43
- display: flex; flex-direction: column; align-items: center; justify-content: center;
44
- transition: opacity 0.5s ease-out;
45
- }
46
-
47
- .loader-track {
48
- width: 280px;
49
- height: 24px;
50
- border: 1px solid #333;
51
- padding: 2px;
52
- position: relative;
53
- background: rgba(0, 255, 65, 0.05);
54
- box-shadow: 0 0 10px rgba(0, 255, 65, 0.1);
55
- }
56
-
57
- .loader-fill {
58
- height: 100%;
59
- background-color: var(--neon-green);
60
- width: 0%;
61
- box-shadow: 0 0 15px var(--neon-green);
62
- position: relative;
63
- /* Effetto righe sulla barra */
64
- background-image: repeating-linear-gradient(
65
- 45deg,
66
- transparent,
67
- transparent 10px,
68
- rgba(0, 0, 0, 0.2) 10px,
69
- rgba(0, 0, 0, 0.2) 20px
70
- );
71
- animation: loadProgress 2.5s ease-out forwards;
72
- }
73
-
74
- @keyframes loadProgress {
75
- 0% { width: 0%; }
76
- 20% { width: 10%; }
77
- 40% { width: 45%; }
78
- 60% { width: 60%; }
79
- 80% { width: 90%; }
80
- 100% { width: 100%; }
81
- }
82
- </style>
83
- </head>
84
- <body>
85
-
86
- <!-- 1. CUSTOM LOADER SCREEN (Migliorato) -->
87
- <div id="custom-loader">
88
- <div class="flex flex-col items-center gap-2 w-full max-w-sm px-6">
89
- <div class="w-full flex justify-between text-[#00ff41] text-xs font-mono mb-1 uppercase tracking-widest opacity-80">
90
- <span>System Boot</span>
91
- <span id="loading-percent">0%</span>
92
- </div>
93
-
94
- <div class="loader-track">
95
- <div class="loader-fill"></div>
96
- </div>
97
-
98
- <div class="w-full mt-2 h-4 text-[#00ff41]/60 text-[10px] font-mono text-left">
99
- > <span id="loading-text">INITIALIZING CORE...</span><span class="blinking-cursor">_</span>
100
- </div>
101
- </div>
102
- </div>
103
-
104
- <!-- 2. VISUAL FX LAYERS -->
105
- <div class="scanlines"></div>
106
- <div class="crt-flicker"></div>
107
-
108
- <!-- 3. UI INTERFACE (OVERLAY) -->
109
- <div id="ui-layer" class="fixed inset-0 z-[100] flex flex-col justify-between p-6 pointer-events-none">
110
-
111
- <!-- Top Bar -->
112
- <div class="flex justify-between items-start pointer-events-auto">
113
- <div class="text-[10px] md:text-xs text-[#00ff41] font-bold tracking-widest bg-black/80 px-2 py-1 border-l-2 border-[#00ff41]">
114
- SYS.STATUS: <span id="sys-status" class="animate-pulse">SCANNING</span>
115
- </div>
116
-
117
- <!-- EXIT BUTTON (LINK A ./index.html) -->
118
- <a href="./index.html" class="flex items-center justify-center w-8 h-8 md:w-10 md:h-10 border border-[#00ff41] bg-black/80 text-[#00ff41] hover:bg-[#00ff41] hover:text-black transition-all backdrop-blur-sm shadow-[0_0_10px_rgba(0,255,65,0.2)]">
119
- <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>
120
- </a>
121
- </div>
122
-
123
- <!-- Center Aim (Crosshair) - Scompare al tag found -->
124
- <div id="aim-overlay" class="absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-48 h-48 border border-[#00ff41]/30 rounded-lg flex items-center justify-center transition-opacity duration-300 pointer-events-none">
125
- <div class="absolute w-full h-[1px] bg-[#00ff41]/20"></div>
126
- <div class="absolute h-full w-[1px] bg-[#00ff41]/20"></div>
127
- <div class="absolute top-0 left-0 w-4 h-4 border-t-2 border-l-2 border-[#00ff41]"></div>
128
- <div class="absolute top-0 right-0 w-4 h-4 border-t-2 border-r-2 border-[#00ff41]"></div>
129
- <div class="absolute bottom-0 left-0 w-4 h-4 border-b-2 border-l-2 border-[#00ff41]"></div>
130
- <div class="absolute bottom-0 right-0 w-4 h-4 border-b-2 border-r-2 border-[#00ff41]"></div>
131
- <div id="target-msg" class="mt-32 text-[#00ff41] text-xs font-bold tracking-widest bg-black/80 px-2">
132
- [ INQUADRA IL TAG ]
133
- </div>
134
- </div>
135
-
136
- <!-- Bottom Controls -->
137
- <div class="w-full max-w-md mx-auto pointer-events-auto transition-all duration-500 text-center">
138
- <!-- Audio Hint Button -->
139
- <button id="audio-btn" class="tech-border px-6 py-3 text-[#00ff41] text-sm font-bold uppercase tracking-widest hover:bg-[#00ff41] hover:text-black transition-all group w-full mb-4">
140
- <span class="mr-2 group-hover:animate-pulse">🔊</span>
141
- <span id="audio-text">CLICCA PER AUDIO</span>
142
- </button>
143
-
144
- <div class="text-[10px] text-[#00ff41]/50 text-center font-mono pointer-events-none">
145
- > WAITING FOR NEURAL HANDSHAKE<span class="blinking-cursor">_</span>
146
- </div>
147
- </div>
148
- </div>
149
-
150
- <!-- 4. MINDAR SCENE -->
151
- <!-- uiLoading: no -> Disabilita il loader blu di default -->
152
- <a-scene
153
- mindar-image="imageTargetSrc: img/targets.mind; filterMinCF:0.0001; filterBeta: 0.001; uiLoading: no; uiScanning: no;"
154
- color-space="sRGB"
155
- renderer="colorManagement: true, physicallyCorrectLights"
156
- vr-mode-ui="enabled: false"
157
- device-orientation-permission-ui="enabled: false">
158
-
159
- <a-assets>
160
- <video id="vid" src="https://matteoscript-innovationlab.static.hf.space/img/video.mp4" autoplay loop muted playsinline webkit-playsinline crossorigin="anonymous"></video>
161
- </a-assets>
162
-
163
- <a-camera position="0 0 0" look-controls="enabled: false"></a-camera>
164
-
165
- <a-entity id="example-target" mindar-image-target="targetIndex: 0">
166
- <!-- Il Video -->
167
- <a-entity id="myVid"
168
- geometry="primitive: plane; width: 1; height: 0.5625"
169
- material="src: #vid; shader: flat; transparent: true; opacity: 1"
170
- position="0 0 0">
171
- </a-entity>
172
-
173
- <!-- CORNICE VERDE (Green Frame) attorno al video -->
174
- <a-plane position="0 0.29 0" width="1.04" height="0.02" color="#00ff41" material="shader: flat"></a-plane>
175
- <a-plane position="0 -0.29 0" width="1.04" height="0.02" color="#00ff41" material="shader: flat"></a-plane>
176
- <a-plane position="-0.51 0 0" width="0.02" height="0.6" color="#00ff41" material="shader: flat"></a-plane>
177
- <a-plane position="0.51 0 0" width="0.02" height="0.6" color="#00ff41" material="shader: flat"></a-plane>
178
- </a-entity>
179
- </a-scene>
180
-
181
- <!-- 5. LOGIC SCRIPT -->
182
- <script>
183
- const video = document.querySelector("#vid");
184
- const target = document.querySelector("#example-target");
185
- const statusText = document.querySelector("#sys-status");
186
- const aimOverlay = document.querySelector("#aim-overlay");
187
- const audioBtn = document.querySelector("#audio-btn");
188
- const audioText = document.querySelector("#audio-text");
189
- const loader = document.querySelector("#custom-loader");
190
- const loadingText = document.querySelector("#loading-text");
191
- const loadingPercent = document.querySelector("#loading-percent");
192
- const scene = document.querySelector("a-scene");
193
- let isAudioEnabled = false;
194
-
195
- // FAKE LOADING TEXT ANIMATION
196
- const loadMessages = [
197
- "CALIBRATING SENSORS...",
198
- "LOADING NEURAL MESH...",
199
- "DECRYPTING VIDEO STREAM...",
200
- "SYNCING AR MATRIX...",
201
- "READY."
202
- ];
203
-
204
- let msgIndex = 0;
205
- let percent = 0;
206
-
207
- const textInterval = setInterval(() => {
208
- if(msgIndex < loadMessages.length) {
209
- loadingText.innerText = loadMessages[msgIndex];
210
- msgIndex++;
211
- }
212
- }, 500);
213
-
214
- const percentInterval = setInterval(() => {
215
- if(percent < 100) {
216
- percent += Math.floor(Math.random() * 5) + 2;
217
- if(percent > 100) percent = 100;
218
- loadingPercent.innerText = percent + "%";
219
- } else {
220
- clearInterval(percentInterval);
221
- }
222
- }, 100);
223
-
224
- // GESTIONE CUSTOM LOADER (AR READY)
225
- scene.addEventListener("arReady", (event) => {
226
- console.log("MindAR Ready");
227
- clearInterval(textInterval);
228
- clearInterval(percentInterval);
229
- loadingPercent.innerText = "100%";
230
- loadingText.innerText = "ACCESS GRANTED.";
231
-
232
- // Ritardo per far vedere il 100%
233
- setTimeout(() => {
234
- loader.style.opacity = "0";
235
- setTimeout(() => {
236
- loader.style.display = "none";
237
- }, 500);
238
- }, 800);
239
- });
240
-
241
- // TARGET FOUND
242
- target.addEventListener("targetFound", event => {
243
- console.log("Target trovato");
244
- video.play();
245
- statusText.innerText = "LOCKED";
246
- statusText.classList.remove("animate-pulse");
247
- statusText.style.color = "#fff";
248
- aimOverlay.style.opacity = '0';
249
- });
250
-
251
- // TARGET LOST
252
- target.addEventListener("targetLost", event => {
253
- console.log("Target perso");
254
- video.pause();
255
- statusText.innerText = "SCANNING";
256
- statusText.classList.add("animate-pulse");
257
- statusText.style.color = "#00ff41";
258
- aimOverlay.style.opacity = '1';
259
- });
260
-
261
- // AUDIO TOGGLE
262
- audioBtn.addEventListener('click', function() {
263
- if (!isAudioEnabled) {
264
- video.muted = false;
265
- isAudioEnabled = true;
266
-
267
- audioText.innerText = "AUDIO: ATTIVO";
268
- audioBtn.classList.add("bg-[#00ff41]", "text-black");
269
- audioBtn.classList.remove("hover:bg-[#00ff41]", "hover:text-black", "tech-border");
270
- audioBtn.style.boxShadow = "0 0 15px #00ff41";
271
-
272
- setTimeout(() => {
273
- audioBtn.style.opacity = '0';
274
- audioBtn.style.pointerEvents = 'none';
275
- }, 2000);
276
- }
277
- });
278
- </script>
279
- </body>
280
- </html>