etnom commited on
Commit
1d03a64
·
verified ·
1 Parent(s): 9ed01d5

Add 2 files

Browse files
Files changed (2) hide show
  1. README.md +7 -5
  2. index.html +313 -19
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Mobius
3
- emoji: 🏃
4
- colorFrom: purple
5
- colorTo: purple
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: mobius
3
+ emoji: 🐳
4
+ colorFrom: blue
5
+ colorTo: blue
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,313 @@
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>Metallic Infinity Möbius Strip</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js"></script>
9
+ <script src="https://cdn.jsdelivr.net/npm/three@0.128.0/examples/js/controls/OrbitControls.min.js"></script>
10
+ <style>
11
+ body {
12
+ margin: 0;
13
+ overflow: hidden;
14
+ background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
15
+ }
16
+ #info {
17
+ position: absolute;
18
+ bottom: 20px;
19
+ width: 100%;
20
+ text-align: center;
21
+ color: white;
22
+ font-family: 'Arial', sans-serif;
23
+ pointer-events: none;
24
+ text-shadow: 0 0 5px rgba(0,0,0,0.5);
25
+ }
26
+ .title {
27
+ position: absolute;
28
+ top: 20px;
29
+ width: 100%;
30
+ text-align: center;
31
+ color: white;
32
+ font-family: 'Arial', sans-serif;
33
+ font-size: 2.5rem;
34
+ font-weight: bold;
35
+ text-shadow: 0 0 15px rgba(255, 215, 0, 0.8);
36
+ }
37
+ .controls {
38
+ position: absolute;
39
+ top: 80px;
40
+ right: 20px;
41
+ background: rgba(0,0,0,0.5);
42
+ padding: 15px;
43
+ border-radius: 10px;
44
+ color: white;
45
+ font-family: 'Arial', sans-serif;
46
+ z-index: 100;
47
+ backdrop-filter: blur(5px);
48
+ border: 1px solid rgba(255, 215, 0, 0.3);
49
+ }
50
+ .control-group {
51
+ margin-bottom: 12px;
52
+ }
53
+ label {
54
+ display: block;
55
+ margin-bottom: 5px;
56
+ color: #ffd700;
57
+ }
58
+ input[type="range"] {
59
+ -webkit-appearance: none;
60
+ width: 100%;
61
+ height: 6px;
62
+ background: rgba(255, 215, 0, 0.2);
63
+ border-radius: 3px;
64
+ outline: none;
65
+ }
66
+ input[type="range"]::-webkit-slider-thumb {
67
+ -webkit-appearance: none;
68
+ width: 16px;
69
+ height: 16px;
70
+ background: #ffd700;
71
+ border-radius: 50%;
72
+ cursor: pointer;
73
+ }
74
+ button {
75
+ transition: all 0.3s ease;
76
+ }
77
+ </style>
78
+ </head>
79
+ <body>
80
+ <div class="title">Metallic Infinity Möbius Strip</div>
81
+ <div class="controls">
82
+ <div class="control-group">
83
+ <label for="rotationSpeed">Rotation Speed</label>
84
+ <input type="range" id="rotationSpeed" min="0" max="0.02" step="0.001" value="0.005">
85
+ </div>
86
+ <div class="control-group">
87
+ <label class="flex items-center">
88
+ <input type="checkbox" id="wireframe" class="mr-2 h-4 w-4 accent-yellow-400">
89
+ <span>Show Wireframe</span>
90
+ </label>
91
+ </div>
92
+ <div class="flex space-x-2 mt-4">
93
+ <button id="pauseBtn" class="bg-yellow-600 hover:bg-yellow-700 text-white px-4 py-2 rounded-lg font-medium shadow-md hover:shadow-lg transform hover:-translate-y-0.5 transition-all">
94
+ Pause
95
+ </button>
96
+ </div>
97
+ </div>
98
+ <div id="info">Drag to rotate | Scroll to zoom</div>
99
+ <script>
100
+ // Initialize Three.js scene
101
+ const scene = new THREE.Scene();
102
+ const camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);
103
+ const renderer = new THREE.WebGLRenderer({ antialias: true });
104
+ renderer.setSize(window.innerWidth, window.innerHeight);
105
+ renderer.setPixelRatio(window.devicePixelRatio);
106
+ renderer.shadowMap.enabled = true;
107
+ renderer.shadowMap.type = THREE.PCFSoftShadowMap;
108
+ document.body.appendChild(renderer.domElement);
109
+
110
+ // Create Infinity Möbius strip geometry
111
+ const createInfinityMobiusStrip = (radius = 1, tubeRadius = 0.3, radialSegments = 128, tubularSegments = 128) => {
112
+ const geometry = new THREE.BufferGeometry();
113
+ const vertices = [];
114
+ const indices = [];
115
+ const normals = [];
116
+ const uvs = [];
117
+
118
+ for (let i = 0; i <= radialSegments; i++) {
119
+ const v = i / radialSegments * Math.PI * 2;
120
+
121
+ for (let j = 0; j <= tubularSegments; j++) {
122
+ const u = j / tubularSegments * Math.PI * 4;
123
+
124
+ // Infinity shape parametric equations (lemniscate of Bernoulli) with Möbius twist
125
+ const scale = 1.5;
126
+ const x = scale * Math.cos(u) / (1 + Math.sin(u)*Math.sin(u));
127
+ const y = scale * Math.sin(u) * Math.cos(u) / (1 + Math.sin(u)*Math.sin(u));
128
+
129
+ // Add tube offset with Möbius twist
130
+ const nx = x + tubeRadius * Math.cos(v/2) * Math.cos(u);
131
+ const ny = y + tubeRadius * Math.cos(v/2) * Math.sin(u);
132
+ const nz = tubeRadius * Math.sin(v/2);
133
+
134
+ vertices.push(nx, ny, nz);
135
+
136
+ // Calculate normals
137
+ const normal = new THREE.Vector3(
138
+ Math.cos(u) * Math.cos(v/2),
139
+ Math.sin(u) * Math.cos(v/2),
140
+ Math.sin(v/2)
141
+ ).normalize();
142
+ normals.push(normal.x, normal.y, normal.z);
143
+
144
+ uvs.push(j / tubularSegments, i / radialSegments);
145
+ }
146
+ }
147
+
148
+ // Create indices
149
+ for (let i = 0; i < radialSegments; i++) {
150
+ for (let j = 0; j < tubularSegments; j++) {
151
+ const a = i * (tubularSegments + 1) + j;
152
+ const b = a + tubularSegments + 1;
153
+ const c = a + 1;
154
+ const d = b + 1;
155
+
156
+ indices.push(a, b, d);
157
+ indices.push(a, d, c);
158
+ }
159
+ }
160
+
161
+ geometry.setIndex(indices);
162
+ geometry.setAttribute('position', new THREE.Float32BufferAttribute(vertices, 3));
163
+ geometry.setAttribute('normal', new THREE.Float32BufferAttribute(normals, 3));
164
+ geometry.setAttribute('uv', new THREE.Float32BufferAttribute(uvs, 2));
165
+
166
+ return geometry;
167
+ };
168
+
169
+ // Create ultra-metallic gold material
170
+ const material = new THREE.MeshPhysicalMaterial({
171
+ color: 0xffd700, // Gold color
172
+ metalness: 1.0,
173
+ roughness: 0.1,
174
+ clearcoat: 1.0,
175
+ clearcoatRoughness: 0.05,
176
+ ior: 2.5,
177
+ specularIntensity: 1.5,
178
+ envMapIntensity: 2.0,
179
+ emissive: 0xffcc00,
180
+ emissiveIntensity: 0.2,
181
+ side: THREE.DoubleSide,
182
+ });
183
+
184
+ const wireframeMaterial = new THREE.MeshBasicMaterial({
185
+ color: 0xffffff,
186
+ wireframe: true,
187
+ transparent: true,
188
+ opacity: 0.3
189
+ });
190
+
191
+ // Create Infinity Möbius strip mesh
192
+ const mobiusStrip = new THREE.Mesh(createInfinityMobiusStrip(2, 0.4, 128, 128), material);
193
+ scene.add(mobiusStrip);
194
+ mobiusStrip.rotation.x = Math.PI / 4;
195
+ mobiusStrip.rotation.y = Math.PI / 4;
196
+
197
+ // Add wireframe version
198
+ const wireframe = new THREE.Mesh(mobiusStrip.geometry, wireframeMaterial);
199
+ scene.add(wireframe);
200
+ wireframe.visible = false;
201
+
202
+ // Add lights for dramatic metallic appearance
203
+ const ambientLight = new THREE.AmbientLight(0x404040, 0.3);
204
+ scene.add(ambientLight);
205
+
206
+ // Main directional light
207
+ const directionalLight1 = new THREE.DirectionalLight(0xffffff, 0.8);
208
+ directionalLight1.position.set(2, 2, 2);
209
+ directionalLight1.castShadow = true;
210
+ directionalLight1.shadow.mapSize.width = 2048;
211
+ directionalLight1.shadow.mapSize.height = 2048;
212
+ scene.add(directionalLight1);
213
+
214
+ // Secondary directional light for contrast
215
+ const directionalLight2 = new THREE.DirectionalLight(0xff9d00, 0.6);
216
+ directionalLight2.position.set(-1, -1, -1);
217
+ scene.add(directionalLight2);
218
+
219
+ // Point light to enhance metallic reflections
220
+ const pointLight = new THREE.PointLight(0xffcc00, 2, 15);
221
+ pointLight.position.set(3, 5, 0);
222
+ pointLight.castShadow = true;
223
+ scene.add(pointLight);
224
+
225
+ // Add another point light for balance
226
+ const pointLight2 = new THREE.PointLight(0xff6600, 1.5, 15);
227
+ pointLight2.position.set(-3, -5, 0);
228
+ scene.add(pointLight2);
229
+
230
+ // Camera position with better angle for the infinity shape
231
+ camera.position.set(0, 3, 10);
232
+ camera.lookAt(0, 0, 0);
233
+
234
+ // Orbit controls with smooth damping
235
+ const controls = new THREE.OrbitControls(camera, renderer.domElement);
236
+ controls.enableDamping = true;
237
+ controls.dampingFactor = 0.05;
238
+ controls.screenSpacePanning = false;
239
+ controls.minDistance = 5;
240
+ controls.maxDistance = 20;
241
+ controls.maxPolarAngle = Math.PI * 0.9;
242
+ controls.minPolarAngle = Math.PI * 0.1;
243
+
244
+ // Add environment map for better reflections
245
+ const cubeTextureLoader = new THREE.CubeTextureLoader();
246
+ const envMap = cubeTextureLoader.load([
247
+ 'https://threejs.org/examples/textures/cube/MilkyWay/dark-s_px.jpg',
248
+ 'https://threejs.org/examples/textures/cube/MilkyWay/dark-s_nx.jpg',
249
+ 'https://threejs.org/examples/textures/cube/MilkyWay/dark-s_py.jpg',
250
+ 'https://threejs.org/examples/textures/cube/MilkyWay/dark-s_ny.jpg',
251
+ 'https://threejs.org/examples/textures/cube/MilkyWay/dark-s_pz.jpg',
252
+ 'https://threejs.org/examples/textures/cube/MilkyWay/dark-s_nz.jpg'
253
+ ]);
254
+ scene.background = envMap;
255
+ scene.environment = envMap;
256
+ material.envMap = envMap;
257
+
258
+ // UI controls
259
+ const rotationSpeedInput = document.getElementById('rotationSpeed');
260
+ const wireframeCheckbox = document.getElementById('wireframe');
261
+ const pauseBtn = document.getElementById('pauseBtn');
262
+
263
+ let isPaused = false;
264
+ let autoRotateSpeed = 0.005;
265
+
266
+ wireframeCheckbox.addEventListener('change', function() {
267
+ wireframe.visible = this.checked;
268
+ });
269
+
270
+ pauseBtn.addEventListener('click', function() {
271
+ isPaused = !isPaused;
272
+ pauseBtn.textContent = isPaused ? 'Play' : 'Pause';
273
+ pauseBtn.classList.toggle('bg-yellow-700');
274
+ pauseBtn.classList.toggle('bg-yellow-600');
275
+ });
276
+
277
+ // Animation loop with smoother rotation
278
+ let time = 0;
279
+ function animate() {
280
+ requestAnimationFrame(animate);
281
+ time += 0.01;
282
+
283
+ if (!isPaused) {
284
+ // Auto rotation with slight variation for visual interest
285
+ mobiusStrip.rotation.x += autoRotateSpeed * 0.8;
286
+ mobiusStrip.rotation.y += autoRotateSpeed * 0.5;
287
+ mobiusStrip.rotation.z += autoRotateSpeed * 0.2;
288
+
289
+ // Add subtle breathing effect to the light
290
+ pointLight.intensity = 2 + Math.sin(time) * 0.5;
291
+ pointLight2.intensity = 1.5 + Math.cos(time * 0.8) * 0.3;
292
+
293
+ // Update rotation speed from UI
294
+ autoRotateSpeed = parseFloat(rotationSpeedInput.value);
295
+
296
+ wireframe.rotation.copy(mobiusStrip.rotation);
297
+ }
298
+
299
+ controls.update();
300
+ renderer.render(scene, camera);
301
+ }
302
+
303
+ // Handle window resize
304
+ window.addEventListener('resize', function() {
305
+ camera.aspect = window.innerWidth / window.innerHeight;
306
+ camera.updateProjectionMatrix();
307
+ renderer.setSize(window.innerWidth, window.innerHeight);
308
+ });
309
+
310
+ animate();
311
+ </script>
312
+ <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=etnom/mobius" style="color: #fff;text-decoration: underline;" target="_blank" >🧬 Remix</a></p></body>
313
+ </html>