Anonimo5703 commited on
Commit
f50ed6e
·
verified ·
1 Parent(s): 7425bc2

Genera la imagen que yo ponga para el juego - Initial Deployment

Browse files
Files changed (2) hide show
  1. README.md +6 -4
  2. index.html +512 -19
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Https Enzostvs Deepsite Hf Space Projects New
3
- emoji: 😻
4
  colorFrom: blue
5
- colorTo: red
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: https-enzostvs-deepsite-hf-space-projects-new
3
+ emoji: 🐳
4
  colorFrom: blue
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,512 @@
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="es">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>FR Legends Livery Generator</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
9
+ <style>
10
+ .canvas-container {
11
+ position: relative;
12
+ width: 100%;
13
+ max-width: 500px;
14
+ margin: 0 auto;
15
+ background-color: #1a1a1a;
16
+ border-radius: 8px;
17
+ overflow: hidden;
18
+ }
19
+
20
+ #previewCanvas {
21
+ width: 100%;
22
+ height: auto;
23
+ display: block;
24
+ }
25
+
26
+ .car-overlay {
27
+ position: absolute;
28
+ top: 0;
29
+ left: 0;
30
+ width: 100%;
31
+ height: 100%;
32
+ pointer-events: none;
33
+ opacity: 0.3;
34
+ }
35
+
36
+ .code-display {
37
+ font-family: 'Courier New', monospace;
38
+ background-color: #2d2d2d;
39
+ color: #f8f8f8;
40
+ padding: 15px;
41
+ border-radius: 6px;
42
+ max-height: 200px;
43
+ overflow-y: auto;
44
+ white-space: pre-wrap;
45
+ word-wrap: break-word;
46
+ }
47
+
48
+ .shape-preview {
49
+ width: 30px;
50
+ height: 30px;
51
+ display: inline-block;
52
+ margin-right: 5px;
53
+ border: 1px solid #555;
54
+ }
55
+
56
+ @keyframes pulse {
57
+ 0% { transform: scale(1); }
58
+ 50% { transform: scale(1.05); }
59
+ 100% { transform: scale(1); }
60
+ }
61
+
62
+ .processing {
63
+ animation: pulse 1.5s infinite;
64
+ }
65
+ </style>
66
+ </head>
67
+ <body class="bg-gray-900 text-white min-h-screen">
68
+ <div class="container mx-auto px-4 py-8">
69
+ <header class="text-center mb-8">
70
+ <h1 class="text-4xl font-bold text-purple-400 mb-2">FR Legends Livery Generator</h1>
71
+ <p class="text-gray-300">Convierte cualquier imagen en un diseño para FR Legends usando solo círculos y cuadrados</p>
72
+ </header>
73
+
74
+ <div class="grid grid-cols-1 lg:grid-cols-2 gap-8">
75
+ <!-- Panel izquierdo - Subir imagen y controles -->
76
+ <div class="bg-gray-800 p-6 rounded-xl shadow-lg">
77
+ <h2 class="text-2xl font-semibold text-purple-300 mb-4">Configuración del diseño</h2>
78
+
79
+ <div class="mb-6">
80
+ <label class="block text-gray-300 mb-2">Sube tu imagen</label>
81
+ <div class="border-2 border-dashed border-gray-600 rounded-lg p-8 text-center hover:border-purple-500 transition-colors cursor-pointer" id="dropZone">
82
+ <input type="file" id="imageInput" accept="image/*" class="hidden">
83
+ <div class="flex flex-col items-center justify-center">
84
+ <i class="fas fa-cloud-upload-alt text-4xl text-purple-400 mb-2"></i>
85
+ <p class="text-gray-400">Arrastra y suelta una imagen o haz clic para seleccionar</p>
86
+ <p class="text-xs text-gray-500 mt-2">Formatos soportados: JPG, PNG, GIF</p>
87
+ </div>
88
+ </div>
89
+ </div>
90
+
91
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6">
92
+ <div>
93
+ <label class="block text-gray-300 mb-2">Nivel de detalle</label>
94
+ <select id="detailLevel" class="w-full bg-gray-700 border border-gray-600 rounded-md px-3 py-2 text-white focus:outline-none focus:ring-2 focus:ring-purple-500">
95
+ <option value="low">Bajo (100 formas)</option>
96
+ <option value="medium" selected>Medio (300 formas)</option>
97
+ <option value="high">Alto (500 formas)</option>
98
+ <option value="extreme">Extremo (1000 formas)</option>
99
+ </select>
100
+ </div>
101
+
102
+ <div>
103
+ <label class="block text-gray-300 mb-2">Tipo de formas</label>
104
+ <select id="shapeType" class="w-full bg-gray-700 border border-gray-600 rounded-md px-3 py-2 text-white focus:outline-none focus:ring-2 focus:ring-purple-500">
105
+ <option value="circles">Solo círculos</option>
106
+ <option value="squares">Solo cuadrados</option>
107
+ <option value="mixed" selected>Mezclados</option>
108
+ </select>
109
+ </div>
110
+ </div>
111
+
112
+ <div class="mb-6">
113
+ <label class="block text-gray-300 mb-2">Tamaño máximo de formas</label>
114
+ <input type="range" id="shapeSize" min="1" max="100" value="50" class="w-full h-2 bg-gray-700 rounded-lg appearance-none cursor-pointer">
115
+ <div class="flex justify-between text-xs text-gray-400 mt-1">
116
+ <span>Pequeño</span>
117
+ <span>Grande</span>
118
+ </div>
119
+ </div>
120
+
121
+ <div class="flex flex-wrap gap-2 mb-6">
122
+ <div class="flex items-center">
123
+ <input type="checkbox" id="mirrorDesign" class="mr-2" checked>
124
+ <label for="mirrorDesign" class="text-gray-300">Espejar diseño (para ambos lados del coche)</label>
125
+ </div>
126
+ <div class="flex items-center">
127
+ <input type="checkbox" id="optimizeColors" class="mr-2" checked>
128
+ <label for="optimizeColors" class="text-gray-300">Optimizar colores (limitar a paleta FR Legends)</label>
129
+ </div>
130
+ </div>
131
+
132
+ <button id="generateBtn" class="w-full bg-purple-600 hover:bg-purple-700 text-white font-bold py-3 px-4 rounded-lg transition-colors flex items-center justify-center">
133
+ <i class="fas fa-magic mr-2"></i> Generar Livery Code
134
+ </button>
135
+ </div>
136
+
137
+ <!-- Panel derecho - Vista previa y código -->
138
+ <div class="bg-gray-800 p-6 rounded-xl shadow-lg">
139
+ <h2 class="text-2xl font-semibold text-purple-300 mb-4">Vista previa y código</h2>
140
+
141
+ <div class="mb-6">
142
+ <div class="flex justify-between items-center mb-2">
143
+ <label class="text-gray-300">Vista previa del diseño</label>
144
+ <div class="text-sm text-gray-400" id="shapeCount">0 formas</div>
145
+ </div>
146
+
147
+ <div class="canvas-container">
148
+ <canvas id="previewCanvas" width="500" height="250"></canvas>
149
+ <img src="https://i.imgur.com/JQ9w7fC.png" class="car-overlay" alt="Car outline">
150
+ </div>
151
+ </div>
152
+
153
+ <div class="mb-4">
154
+ <label class="block text-gray-300 mb-2">Código generado</label>
155
+ <div class="code-display" id="generatedCode">
156
+ Sube una imagen y haz clic en "Generar Livery Code" para crear tu diseño.
157
+ </div>
158
+ </div>
159
+
160
+ <div class="flex flex-wrap gap-2">
161
+ <button id="copyCodeBtn" class="bg-gray-700 hover:bg-gray-600 text-white py-2 px-4 rounded-md transition-colors flex items-center">
162
+ <i class="fas fa-copy mr-2"></i> Copiar código
163
+ </button>
164
+ <button id="downloadBtn" class="bg-gray-700 hover:bg-gray-600 text-white py-2 px-4 rounded-md transition-colors flex items-center">
165
+ <i class="fas fa-download mr-2"></i> Descargar imagen
166
+ </button>
167
+ <button id="shareBtn" class="bg-gray-700 hover:bg-gray-600 text-white py-2 px-4 rounded-md transition-colors flex items-center">
168
+ <i class="fas fa-share-alt mr-2"></i> Compartir
169
+ </button>
170
+ </div>
171
+
172
+ <div class="mt-6">
173
+ <h3 class="text-lg font-medium text-purple-300 mb-2">Cómo usar este código en FR Legends:</h3>
174
+ <ol class="list-decimal list-inside text-gray-300 text-sm space-y-1">
175
+ <li>Abre FR Legends y ve al editor de liveries</li>
176
+ <li>Selecciona "Importar código"</li>
177
+ <li>Pega el código generado</li>
178
+ <li>Ajusta la posición si es necesario</li>
179
+ </ol>
180
+ </div>
181
+ </div>
182
+ </div>
183
+
184
+ <div class="mt-12 bg-gray-800 p-6 rounded-xl shadow-lg">
185
+ <h2 class="text-2xl font-semibold text-purple-300 mb-4">Ejemplos de diseños</h2>
186
+ <div class="grid grid-cols-2 md:grid-cols-4 gap-4">
187
+ <div class="cursor-pointer" onclick="loadExample('example1')">
188
+ <img src="https://i.imgur.com/JQ9w7fC.png" class="w-full h-auto rounded-md border-2 border-gray-700 hover:border-purple-500 transition-colors" alt="Example 1">
189
+ <p class="text-center text-gray-300 mt-2">Diseño simple</p>
190
+ </div>
191
+ <div class="cursor-pointer" onclick="loadExample('example2')">
192
+ <img src="https://i.imgur.com/JQ9w7fC.png" class="w-full h-auto rounded-md border-2 border-gray-700 hover:border-purple-500 transition-colors" alt="Example 2">
193
+ <p class="text-center text-gray-300 mt-2">Patrón geométrico</p>
194
+ </div>
195
+ <div class="cursor-pointer" onclick="loadExample('example3')">
196
+ <img src="https://i.imgur.com/JQ9w7fC.png" class="w-full h-auto rounded-md border-2 border-gray-700 hover:border-purple-500 transition-colors" alt="Example 3">
197
+ <p class="text-center text-gray-300 mt-2">Retrato</p>
198
+ </div>
199
+ <div class="cursor-pointer" onclick="loadExample('example4')">
200
+ <img src="https://i.imgur.com/JQ9w7fC.png" class="w-full h-auto rounded-md border-2 border-gray-700 hover:border-purple-500 transition-colors" alt="Example 4">
201
+ <p class="text-center text-gray-300 mt-2">Logo de equipo</p>
202
+ </div>
203
+ </div>
204
+ </div>
205
+ </div>
206
+
207
+ <script>
208
+ document.addEventListener('DOMContentLoaded', function() {
209
+ // Elementos del DOM
210
+ const dropZone = document.getElementById('dropZone');
211
+ const imageInput = document.getElementById('imageInput');
212
+ const previewCanvas = document.getElementById('previewCanvas');
213
+ const ctx = previewCanvas.getContext('2d');
214
+ const generateBtn = document.getElementById('generateBtn');
215
+ const copyCodeBtn = document.getElementById('copyCodeBtn');
216
+ const downloadBtn = document.getElementById('downloadBtn');
217
+ const shareBtn = document.getElementById('shareBtn');
218
+ const generatedCode = document.getElementById('generatedCode');
219
+ const shapeCount = document.getElementById('shapeCount');
220
+
221
+ // Variables de estado
222
+ let uploadedImage = null;
223
+ let generatedLiveryCode = '';
224
+
225
+ // Configurar zona de arrastre
226
+ dropZone.addEventListener('click', () => imageInput.click());
227
+
228
+ imageInput.addEventListener('change', handleFileSelect);
229
+
230
+ ['dragenter', 'dragover', 'dragleave', 'drop'].forEach(eventName => {
231
+ dropZone.addEventListener(eventName, preventDefaults, false);
232
+ });
233
+
234
+ function preventDefaults(e) {
235
+ e.preventDefault();
236
+ e.stopPropagation();
237
+ }
238
+
239
+ ['dragenter', 'dragover'].forEach(eventName => {
240
+ dropZone.addEventListener(eventName, highlight, false);
241
+ });
242
+
243
+ ['dragleave', 'drop'].forEach(eventName => {
244
+ dropZone.addEventListener(eventName, unhighlight, false);
245
+ });
246
+
247
+ function highlight() {
248
+ dropZone.classList.add('border-purple-500');
249
+ dropZone.classList.remove('border-gray-600');
250
+ }
251
+
252
+ function unhighlight() {
253
+ dropZone.classList.remove('border-purple-500');
254
+ dropZone.classList.add('border-gray-600');
255
+ }
256
+
257
+ dropZone.addEventListener('drop', handleDrop, false);
258
+
259
+ function handleDrop(e) {
260
+ const dt = e.dataTransfer;
261
+ const files = dt.files;
262
+ if (files.length) {
263
+ handleFiles(files);
264
+ }
265
+ }
266
+
267
+ function handleFileSelect(e) {
268
+ const files = e.target.files;
269
+ if (files.length) {
270
+ handleFiles(files);
271
+ }
272
+ }
273
+
274
+ function handleFiles(files) {
275
+ const file = files[0];
276
+ if (!file.type.match('image.*')) {
277
+ alert('Por favor, sube solo archivos de imagen.');
278
+ return;
279
+ }
280
+
281
+ const reader = new FileReader();
282
+ reader.onload = function(e) {
283
+ const img = new Image();
284
+ img.onload = function() {
285
+ uploadedImage = img;
286
+ drawPreviewImage();
287
+ };
288
+ img.src = e.target.result;
289
+ };
290
+ reader.readAsDataURL(file);
291
+ }
292
+
293
+ function drawPreviewImage() {
294
+ if (!uploadedImage) return;
295
+
296
+ const canvas = previewCanvas;
297
+ const ctx = canvas.getContext('2d');
298
+
299
+ // Limpiar canvas
300
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
301
+
302
+ // Dibujar la imagen escalada para que quepa en el canvas
303
+ const ratio = Math.min(canvas.width / uploadedImage.width, canvas.height / uploadedImage.height);
304
+ const width = uploadedImage.width * ratio;
305
+ const height = uploadedImage.height * ratio;
306
+ const x = (canvas.width - width) / 2;
307
+ const y = (canvas.height - height) / 2;
308
+
309
+ ctx.drawImage(uploadedImage, x, y, width, height);
310
+ }
311
+
312
+ // Generar código de livery
313
+ generateBtn.addEventListener('click', generateLiveryCode);
314
+
315
+ function generateLiveryCode() {
316
+ if (!uploadedImage) {
317
+ alert('Por favor, sube una imagen primero.');
318
+ return;
319
+ }
320
+
321
+ generateBtn.classList.add('processing');
322
+ generateBtn.innerHTML = '<i class="fas fa-spinner fa-spin mr-2"></i> Procesando...';
323
+ generatedCode.textContent = 'Generando código, por favor espera...';
324
+
325
+ // Obtener configuraciones
326
+ const detailLevel = document.getElementById('detailLevel').value;
327
+ const shapeType = document.getElementById('shapeType').value;
328
+ const shapeSize = parseInt(document.getElementById('shapeSize').value);
329
+ const mirrorDesign = document.getElementById('mirrorDesign').checked;
330
+ const optimizeColors = document.getElementById('optimizeColors').checked;
331
+
332
+ // Procesar la imagen en un worker para no bloquear la UI
333
+ const worker = new Worker('imageProcessor.js');
334
+
335
+ worker.onmessage = function(e) {
336
+ const { code, numShapes } = e.data;
337
+
338
+ generatedLiveryCode = code;
339
+ generatedCode.textContent = code;
340
+ shapeCount.textContent = `${numShapes} formas`;
341
+
342
+ drawShapePreviewFromCode(code);
343
+
344
+ generateBtn.classList.remove('processing');
345
+ generateBtn.innerHTML = '<i class="fas fa-magic mr-2"></i> Generar Livery Code';
346
+ };
347
+
348
+ // Preparar datos para el worker
349
+ const canvas = document.createElement('canvas');
350
+ canvas.width = uploadedImage.width;
351
+ canvas.height = uploadedImage.height;
352
+ const ctx = canvas.getContext('2d');
353
+ ctx.drawImage(uploadedImage, 0, 0);
354
+ const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height).data;
355
+
356
+ worker.postMessage({
357
+ imageData,
358
+ width: canvas.width,
359
+ height: canvas.height,
360
+ detailLevel,
361
+ shapeType,
362
+ shapeSize,
363
+ mirrorDesign,
364
+ optimizeColors
365
+ });
366
+ }
367
+
368
+ function getShapeCount(level) {
369
+ switch(level) {
370
+ case 'low': return 100;
371
+ case 'medium': return 300;
372
+ case 'high': return 500;
373
+ case 'extreme': return 1000;
374
+ default: return 300;
375
+ }
376
+ }
377
+
378
+ function drawShapePreviewFromCode(code) {
379
+ const canvas = previewCanvas;
380
+ const ctx = canvas.getContext('2d');
381
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
382
+
383
+ const lines = code.split('\n').filter(line =>
384
+ line.startsWith('circle,') || line.startsWith('square,')
385
+ );
386
+
387
+ lines.forEach(line => {
388
+ const [shape, x, y, width, height, rotation, color] = line.split(',');
389
+ const scaleX = canvas.width / 100;
390
+ const scaleY = canvas.height / 100;
391
+
392
+ ctx.save();
393
+ ctx.translate(parseFloat(x) * scaleX, parseFloat(y) * scaleY);
394
+ ctx.rotate(parseFloat(rotation) * Math.PI / 180);
395
+ ctx.fillStyle = `#${color}`;
396
+
397
+ if (shape === 'circle') {
398
+ const radius = parseFloat(width) * scaleX / 2;
399
+ ctx.beginPath();
400
+ ctx.arc(0, 0, radius, 0, Math.PI * 2);
401
+ ctx.fill();
402
+ } else {
403
+ ctx.fillRect(
404
+ -parseFloat(width) * scaleX / 2,
405
+ -parseFloat(height) * scaleY / 2,
406
+ parseFloat(width) * scaleX,
407
+ parseFloat(height) * scaleY
408
+ );
409
+ }
410
+
411
+ ctx.restore();
412
+ });
413
+ }
414
+
415
+ function drawShapePreview(count, shapeType, size) {
416
+ const canvas = previewCanvas;
417
+ const ctx = canvas.getContext('2d');
418
+
419
+ // Limpiar canvas
420
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
421
+
422
+ // Dibujar formas aleatorias
423
+ for (let i = 0; i < count; i++) {
424
+ const x = Math.random() * canvas.width;
425
+ const y = Math.random() * canvas.height;
426
+ const width = 5 + Math.random() * (size / 2);
427
+ const height = shapeType === 'circles' ? width : 5 + Math.random() * (size / 2);
428
+ const rotation = Math.random() * 360;
429
+ const color = `#${Math.floor(Math.random() * 16777215).toString(16).padStart(6, '0')}`;
430
+
431
+ const shape = shapeType === 'mixed' ?
432
+ (Math.random() > 0.5 ? 'circle' : 'square') :
433
+ (shapeType === 'circles' ? 'circle' : 'square');
434
+
435
+ ctx.save();
436
+ ctx.translate(x, y);
437
+ ctx.rotate(rotation * Math.PI / 180);
438
+ ctx.fillStyle = color;
439
+
440
+ if (shape === 'circle') {
441
+ ctx.beginPath();
442
+ ctx.arc(0, 0, width / 2, 0, Math.PI * 2);
443
+ ctx.fill();
444
+ } else {
445
+ ctx.fillRect(-width / 2, -height / 2, width, height);
446
+ }
447
+
448
+ ctx.restore();
449
+ }
450
+ }
451
+
452
+ // Copiar código al portapapeles
453
+ copyCodeBtn.addEventListener('click', function() {
454
+ if (!generatedLiveryCode) {
455
+ alert('No hay código para copiar. Genera un diseño primero.');
456
+ return;
457
+ }
458
+
459
+ navigator.clipboard.writeText(generatedLiveryCode).then(() => {
460
+ const originalText = copyCodeBtn.innerHTML;
461
+ copyCodeBtn.innerHTML = '<i class="fas fa-check mr-2"></i> ¡Copiado!';
462
+ setTimeout(() => {
463
+ copyCodeBtn.innerHTML = originalText;
464
+ }, 2000);
465
+ }).catch(err => {
466
+ console.error('Error al copiar: ', err);
467
+ alert('No se pudo copiar el código. Inténtalo de nuevo.');
468
+ });
469
+ });
470
+
471
+ // Descargar imagen
472
+ downloadBtn.addEventListener('click', function() {
473
+ if (!uploadedImage) {
474
+ alert('No hay imagen para descargar. Sube una imagen primero.');
475
+ return;
476
+ }
477
+
478
+ const link = document.createElement('a');
479
+ link.download = 'fr-legends-livery.png';
480
+ link.href = previewCanvas.toDataURL('image/png');
481
+ link.click();
482
+ });
483
+
484
+ // Compartir
485
+ shareBtn.addEventListener('click', function() {
486
+ if (!generatedLiveryCode) {
487
+ alert('No hay diseño para compartir. Genera un diseño primero.');
488
+ return;
489
+ }
490
+
491
+ if (navigator.share) {
492
+ navigator.share({
493
+ title: 'Mi diseño para FR Legends',
494
+ text: 'Mira este diseño que creé con el FR Legends Livery Generator',
495
+ url: window.location.href
496
+ }).catch(err => {
497
+ console.log('Error al compartir:', err);
498
+ });
499
+ } else {
500
+ alert('La función de compartir no está disponible en tu navegador. Copia el código manualmente.');
501
+ }
502
+ });
503
+
504
+ // Cargar ejemplos
505
+ window.loadExample = function(exampleId) {
506
+ // En una aplicación real, esto cargaría imágenes de ejemplo
507
+ alert('En una aplicación real, esto cargaría un ejemplo de diseño.');
508
+ };
509
+ });
510
+ </script>
511
+ <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=Anonimo5703/https-enzostvs-deepsite-hf-space-projects-new" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
512
+ </html>