triton7777 commited on
Commit
5be9084
·
verified ·
1 Parent(s): 4b2ed9b

Add 2 files

Browse files
Files changed (2) hide show
  1. README.md +6 -4
  2. index.html +347 -19
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Ar Sample
3
- emoji: 🏢
4
  colorFrom: yellow
5
- colorTo: pink
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: ar-sample
3
+ emoji: 🐳
4
  colorFrom: yellow
5
+ colorTo: gray
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite
10
  ---
11
 
12
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
index.html CHANGED
@@ -1,19 +1,347 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>FutureScape AR</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <script src="https://cdn.jsdelivr.net/npm/three@0.132.2/build/three.min.js"></script>
9
+ <script src="https://cdn.jsdelivr.net/npm/three@0.132.2/examples/js/controls/OrbitControls.js"></script>
10
+ <script src="https://cdn.jsdelivr.net/npm/three@0.132.2/examples/js/webxr/VRButton.js"></script>
11
+ <style>
12
+ @import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700&display=swap');
13
+
14
+ body {
15
+ margin: 0;
16
+ overflow: hidden;
17
+ font-family: 'Orbitron', sans-serif;
18
+ background-color: transparent !important;
19
+ }
20
+
21
+ #ar-container {
22
+ position: absolute;
23
+ width: 100vw;
24
+ height: 100vh;
25
+ pointer-events: none;
26
+ }
27
+
28
+ .ar-panel {
29
+ backdrop-filter: blur(10px);
30
+ background: rgba(0, 0, 30, 0.7);
31
+ border-radius: 16px;
32
+ border: 1px solid rgba(100, 200, 255, 0.3);
33
+ box-shadow: 0 0 30px rgba(0, 150, 255, 0.5);
34
+ color: white;
35
+ padding: 20px;
36
+ position: absolute;
37
+ transform: translate(-50%, -50%);
38
+ transition: all 0.3s ease;
39
+ }
40
+
41
+ .ar-button {
42
+ backdrop-filter: blur(5px);
43
+ background: rgba(0, 50, 100, 0.5);
44
+ border-radius: 12px;
45
+ border: 1px solid rgba(100, 200, 255, 0.5);
46
+ box-shadow: 0 0 15px rgba(0, 150, 255, 0.3);
47
+ color: white;
48
+ cursor: pointer;
49
+ font-size: 18px;
50
+ font-weight: bold;
51
+ padding: 15px 25px;
52
+ pointer-events: auto;
53
+ position: absolute;
54
+ text-align: center;
55
+ transition: all 0.2s ease;
56
+ user-select: none;
57
+ }
58
+
59
+ .ar-button:hover, .ar-button.active {
60
+ background: rgba(0, 100, 200, 0.7);
61
+ box-shadow: 0 0 25px rgba(0, 200, 255, 0.7);
62
+ transform: scale(1.05);
63
+ }
64
+
65
+ .ar-button:active {
66
+ transform: scale(0.98);
67
+ }
68
+
69
+ .title-text {
70
+ background: linear-gradient(90deg, #00ffff, #0088ff);
71
+ -webkit-background-clip: text;
72
+ background-clip: text;
73
+ color: transparent;
74
+ font-size: 2.5rem;
75
+ font-weight: bold;
76
+ text-shadow: 0 0 10px rgba(0, 200, 255, 0.5);
77
+ animation: pulse 2s infinite alternate;
78
+ }
79
+
80
+ @keyframes pulse {
81
+ 0% { text-shadow: 0 0 10px rgba(0, 200, 255, 0.5); }
82
+ 100% { text-shadow: 0 0 20px rgba(0, 255, 255, 0.8); }
83
+ }
84
+
85
+ .particle {
86
+ position: absolute;
87
+ background: rgba(0, 200, 255, 0.7);
88
+ border-radius: 50%;
89
+ pointer-events: none;
90
+ }
91
+
92
+ #gaze-cursor {
93
+ position: absolute;
94
+ width: 20px;
95
+ height: 20px;
96
+ border-radius: 50%;
97
+ background: rgba(255, 255, 255, 0.8);
98
+ box-shadow: 0 0 10px rgba(0, 200, 255, 0.8);
99
+ transform: translate(-50%, -50%);
100
+ pointer-events: none;
101
+ z-index: 1000;
102
+ transition: transform 0.1s ease-out;
103
+ }
104
+
105
+ #gaze-timer {
106
+ position: absolute;
107
+ width: 24px;
108
+ height: 24px;
109
+ border-radius: 50%;
110
+ border: 2px solid rgba(0, 200, 255, 0.8);
111
+ transform: translate(-50%, -50%);
112
+ pointer-events: none;
113
+ z-index: 1001;
114
+ }
115
+ </style>
116
+ </head>
117
+ <body>
118
+ <div id="ar-container">
119
+ <div id="welcome-panel" class="ar-panel" style="top: 50%; left: 50%; width: 80%; max-width: 500px;">
120
+ <h1 class="title-text text-center mb-4">Welcome to FutureScape AR</h1>
121
+ <p class="text-white text-opacity-80 text-center">Experience the future of spatial computing with our augmented reality interface.</p>
122
+ </div>
123
+
124
+ <div id="explore-btn" class="ar-button" style="top: 70%; left: 30%;">Explore</div>
125
+ <div id="map-btn" class="ar-button" style="top: 70%; left: 50%;">Map</div>
126
+ <div id="scan-btn" class="ar-button" style="top: 70%; left: 70%;">Scan</div>
127
+
128
+ <div id="gaze-cursor"></div>
129
+ <div id="gaze-timer"></div>
130
+ </div>
131
+
132
+ <script>
133
+ // Three.js and WebXR setup
134
+ let camera, scene, renderer;
135
+ let controller;
136
+
137
+ // UI elements
138
+ const welcomePanel = document.getElementById('welcome-panel');
139
+ const exploreBtn = document.getElementById('explore-btn');
140
+ const mapBtn = document.getElementById('map-btn');
141
+ const scanBtn = document.getElementById('scan-btn');
142
+ const gazeCursor = document.getElementById('gaze-cursor');
143
+ const gazeTimer = document.getElementById('gaze-timer');
144
+
145
+ // Gaze interaction variables
146
+ let gazeTarget = null;
147
+ let gazeStartTime = 0;
148
+ let gazeProgress = 0;
149
+ const gazeTimeThreshold = 1000; // 1 second to activate
150
+
151
+ // Initialize Three.js scene
152
+ function initXR() {
153
+ scene = new THREE.Scene();
154
+ camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 0.1, 10);
155
+
156
+ renderer = new THREE.WebGLRenderer({ antialias: true, alpha: true });
157
+ renderer.setPixelRatio(window.devicePixelRatio);
158
+ renderer.setSize(window.innerWidth, window.innerHeight);
159
+ renderer.xr.enabled = true;
160
+ document.body.appendChild(renderer.domElement);
161
+
162
+ // Add basic lighting
163
+ const ambientLight = new THREE.AmbientLight(0x404040);
164
+ scene.add(ambientLight);
165
+
166
+ const directionalLight = new THREE.DirectionalLight(0xffffff, 0.5);
167
+ directionalLight.position.set(0, 1, 0);
168
+ scene.add(directionalLight);
169
+
170
+ // Add controller for gaze detection
171
+ controller = renderer.xr.getController(0);
172
+ controller.addEventListener('move', onControllerMove);
173
+ scene.add(controller);
174
+
175
+ // Add WebXR button
176
+ document.body.appendChild(VRButton.createButton(renderer));
177
+
178
+ // Handle window resize
179
+ window.addEventListener('resize', onWindowResize);
180
+
181
+ // Start animation loop
182
+ renderer.setAnimationLoop(render);
183
+ }
184
+
185
+ function onWindowResize() {
186
+ camera.aspect = window.innerWidth / window.innerHeight;
187
+ camera.updateProjectionMatrix();
188
+ renderer.setSize(window.innerWidth, window.innerHeight);
189
+ }
190
+
191
+ function onControllerMove(event) {
192
+ // Convert controller position to screen coordinates for gaze cursor
193
+ const position = event.target.position.clone();
194
+ position.project(camera);
195
+
196
+ const x = (position.x * 0.5 + 0.5) * window.innerWidth;
197
+ const y = (-(position.y * 0.5) + 0.5) * window.innerHeight;
198
+
199
+ gazeCursor.style.left = `${x}px`;
200
+ gazeCursor.style.top = `${y}px`;
201
+
202
+ // Check for UI element hover
203
+ checkGazeIntersection(x, y);
204
+ }
205
+
206
+ function checkGazeIntersection(x, y) {
207
+ const elements = [exploreBtn, mapBtn, scanBtn];
208
+ let newTarget = null;
209
+
210
+ elements.forEach(element => {
211
+ const rect = element.getBoundingClientRect();
212
+ const isHovering = x >= rect.left && x <= rect.right && y >= rect.top && y <= rect.bottom;
213
+
214
+ if (isHovering) {
215
+ newTarget = element;
216
+ element.classList.add('active');
217
+ } else {
218
+ element.classList.remove('active');
219
+ }
220
+ });
221
+
222
+ // Handle gaze target changes
223
+ if (newTarget !== gazeTarget) {
224
+ gazeTarget = newTarget;
225
+ gazeStartTime = performance.now();
226
+ gazeProgress = 0;
227
+ gazeTimer.style.width = '0px';
228
+ gazeTimer.style.height = '0px';
229
+ }
230
+
231
+ // Update gaze timer if hovering
232
+ if (gazeTarget) {
233
+ const elapsed = performance.now() - gazeStartTime;
234
+ gazeProgress = Math.min(elapsed / gazeTimeThreshold, 1);
235
+
236
+ const size = 24 + 20 * gazeProgress;
237
+ gazeTimer.style.width = `${size}px`;
238
+ gazeTimer.style.height = `${size}px`;
239
+ gazeTimer.style.borderColor = `rgba(0, 200, 255, ${0.8 * gazeProgress})`;
240
+
241
+ if (gazeProgress >= 1) {
242
+ activateButton(gazeTarget);
243
+ gazeTarget = null;
244
+ }
245
+ }
246
+ }
247
+
248
+ function activateButton(button) {
249
+ // Visual feedback
250
+ button.style.transform = 'scale(0.95)';
251
+ button.style.boxShadow = '0 0 30px rgba(0, 255, 255, 0.9)';
252
+
253
+ // Create particle effect
254
+ createParticles(button);
255
+
256
+ // Handle button action
257
+ setTimeout(() => {
258
+ button.style.transform = 'scale(1.05)';
259
+
260
+ switch(button.id) {
261
+ case 'explore-btn':
262
+ welcomePanel.querySelector('h1').textContent = 'Explore Mode Activated';
263
+ break;
264
+ case 'map-btn':
265
+ welcomePanel.querySelector('h1').textContent = 'Map View Engaged';
266
+ break;
267
+ case 'scan-btn':
268
+ welcomePanel.querySelector('h1').textContent = 'Scanning Environment';
269
+ break;
270
+ }
271
+ }, 100);
272
+ }
273
+
274
+ function createParticles(element) {
275
+ const rect = element.getBoundingClientRect();
276
+ const centerX = rect.left + rect.width / 2;
277
+ const centerY = rect.top + rect.height / 2;
278
+
279
+ for (let i = 0; i < 20; i++) {
280
+ const particle = document.createElement('div');
281
+ particle.className = 'particle';
282
+
283
+ const size = Math.random() * 8 + 4;
284
+ particle.style.width = `${size}px`;
285
+ particle.style.height = `${size}px`;
286
+
287
+ const angle = Math.random() * Math.PI * 2;
288
+ const distance = Math.random() * 50 + 30;
289
+ const x = centerX + Math.cos(angle) * distance;
290
+ const y = centerY + Math.sin(angle) * distance;
291
+
292
+ particle.style.left = `${x}px`;
293
+ particle.style.top = `${y}px`;
294
+
295
+ document.body.appendChild(particle);
296
+
297
+ // Animate particle
298
+ const duration = Math.random() * 1000 + 500;
299
+ const targetX = x + (Math.random() - 0.5) * 100;
300
+ const targetY = y + (Math.random() - 0.5) * 100;
301
+
302
+ const animation = particle.animate([
303
+ {
304
+ transform: 'translate(0, 0) scale(1)',
305
+ opacity: 1
306
+ },
307
+ {
308
+ transform: `translate(${targetX - x}px, ${targetY - y}px) scale(0.1)`,
309
+ opacity: 0
310
+ }
311
+ ], {
312
+ duration: duration,
313
+ easing: 'cubic-bezier(0.4, 0, 0.2, 1)'
314
+ });
315
+
316
+ animation.onfinish = () => particle.remove();
317
+ }
318
+ }
319
+
320
+ function render() {
321
+ renderer.render(scene, camera);
322
+ }
323
+
324
+ // Initialize the AR experience
325
+ window.addEventListener('load', () => {
326
+ initXR();
327
+
328
+ // Add floating animation to welcome panel
329
+ let floatOffset = 0;
330
+ let floatDirection = 1;
331
+
332
+ function floatAnimation() {
333
+ floatOffset += 0.2 * floatDirection;
334
+
335
+ if (Math.abs(floatOffset) > 5) {
336
+ floatDirection *= -1;
337
+ }
338
+
339
+ welcomePanel.style.transform = `translate(-50%, calc(-50% + ${floatOffset}px))`;
340
+ requestAnimationFrame(floatAnimation);
341
+ }
342
+
343
+ floatAnimation();
344
+ });
345
+ </script>
346
+ <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=triton7777/ar-sample" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
347
+ </html>