samlax12 commited on
Commit
6a1b44a
·
verified ·
1 Parent(s): c6bf4be

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +69 -68
index.html CHANGED
@@ -102,12 +102,6 @@
102
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.5);
103
  }
104
 
105
- .design-option img {
106
- width: 100%;
107
- height: 100%;
108
- object-fit: cover;
109
- }
110
-
111
  .slider-container {
112
  margin: 15px 0;
113
  color: white;
@@ -281,6 +275,11 @@
281
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
282
  z-index: 20;
283
  }
 
 
 
 
 
284
  </style>
285
  </head>
286
 
@@ -312,23 +311,23 @@
312
  <div class="control-section">
313
  <div class="section-title">Nail Design</div>
314
  <div class="design-options">
315
- <div class="design-option selected" data-design="gradient">
316
- <img src="https://i.ibb.co/2WyMYRq/gradient.jpg" alt="Gradient Nails">
317
  </div>
318
- <div class="design-option" data-design="marble">
319
- <img src="https://i.ibb.co/LgTT2B0/marble.jpg" alt="Marble Nails">
320
  </div>
321
- <div class="design-option" data-design="holographic">
322
- <img src="https://i.ibb.co/pP9Xnzq/holographic.jpg" alt="Holographic Nails">
323
  </div>
324
- <div class="design-option" data-design="glitter">
325
- <img src="https://i.ibb.co/S0ThyfD/glitter.jpg" alt="Glitter Nails">
326
  </div>
327
- <div class="design-option" data-design="french">
328
- <img src="https://i.ibb.co/9sZsq2f/french.jpg" alt="French Manicure">
329
  </div>
330
- <div class="design-option" data-design="matte">
331
- <img src="https://i.ibb.co/QC5tDn2/matte.jpg" alt="Matte Finish">
332
  </div>
333
  </div>
334
  </div>
@@ -381,59 +380,47 @@
381
  </div>
382
 
383
  <script>
384
- // Define nail patterns and their properties
385
- const nailPatterns = {
386
- gradient: {
387
- image: 'https://i.ibb.co/2WyMYRq/gradient.jpg',
388
- shadowColor: 'rgba(255, 100, 150, 0.3)'
389
  },
390
- marble: {
391
- image: 'https://i.ibb.co/LgTT2B0/marble.jpg',
392
- shadowColor: 'rgba(200, 200, 200, 0.3)'
393
  },
394
- holographic: {
395
- image: 'https://i.ibb.co/pP9Xnzq/holographic.jpg',
396
- shadowColor: 'rgba(100, 200, 255, 0.3)'
397
  },
398
- glitter: {
399
- image: 'https://i.ibb.co/S0ThyfD/glitter.jpg',
400
- shadowColor: 'rgba(255, 215, 0, 0.3)'
401
  },
402
- french: {
403
- image: 'https://i.ibb.co/9sZsq2f/french.jpg',
404
- shadowColor: 'rgba(255, 255, 255, 0.3)'
405
  },
406
- matte: {
407
- image: 'https://i.ibb.co/QC5tDn2/matte.jpg',
408
- shadowColor: 'rgba(100, 100, 100, 0.3)'
409
  }
410
  };
411
 
412
- // Nail design images preloading
413
- const nailImages = {};
414
- let loadedImages = 0;
415
- const totalImages = Object.keys(nailPatterns).length;
416
-
417
- for (const design in nailPatterns) {
418
- nailImages[design] = new Image();
419
- nailImages[design].onload = () => {
420
- loadedImages++;
421
- if (loadedImages === totalImages) {
422
- // All images loaded, hide loading screen
423
- document.querySelector('.loading-screen').style.opacity = 0;
424
- setTimeout(() => {
425
- document.querySelector('.loading-screen').style.display = 'none';
426
- }, 500);
427
- }
428
- };
429
- nailImages[design].src = nailPatterns[design].image;
430
- }
431
 
432
  // Initialize variables
433
- let currentDesign = 'gradient';
434
  let sizeScale = 1.0;
435
  let lengthScale = 1.0;
436
- let opacityValue = 1.0;
437
  let showShadows = true;
438
  let showLines = false;
439
  let facingMode = 'environment'; // 'user' = front camera, 'environment' = back camera
@@ -469,7 +456,7 @@
469
  });
470
 
471
  opacitySlider.addEventListener('input', (e) => {
472
- opacityValue = parseInt(e.target.value) / 100;
473
  opacityValue.textContent = `${e.target.value}%`;
474
  });
475
 
@@ -542,7 +529,7 @@
542
  // Draw nail shadow if enabled
543
  if (showShadows) {
544
  ctx.save();
545
- ctx.shadowColor = nailPatterns[design].shadowColor;
546
  ctx.shadowBlur = 15;
547
  ctx.shadowOffsetX = 0;
548
  ctx.shadowOffsetY = 5;
@@ -558,13 +545,27 @@
558
  ctx.ellipse(0, 0, nailWidth/2, nailLength/2, 0, 0, Math.PI * 2);
559
  ctx.clip();
560
 
561
- // Draw the nail design pattern
562
- ctx.globalAlpha = opacityValue;
563
- ctx.drawImage(
564
- nailImages[design],
565
- -nailWidth/2, -nailLength/2,
566
- nailWidth, nailLength
567
- );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
568
 
569
  // Restore context
570
  ctx.restore();
 
102
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.5);
103
  }
104
 
 
 
 
 
 
 
105
  .slider-container {
106
  margin: 15px 0;
107
  color: white;
 
275
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
276
  z-index: 20;
277
  }
278
+
279
+ .color-block {
280
+ width: 100%;
281
+ height: 100%;
282
+ }
283
  </style>
284
  </head>
285
 
 
311
  <div class="control-section">
312
  <div class="section-title">Nail Design</div>
313
  <div class="design-options">
314
+ <div class="design-option selected" data-design="pink">
315
+ <div class="color-block" style="background: linear-gradient(45deg, #ff9a9e, #fad0c4);"></div>
316
  </div>
317
+ <div class="design-option" data-design="blue">
318
+ <div class="color-block" style="background: linear-gradient(45deg, #2193b0, #6dd5ed);"></div>
319
  </div>
320
+ <div class="design-option" data-design="purple">
321
+ <div class="color-block" style="background: linear-gradient(45deg, #c471f5, #fa71cd);"></div>
322
  </div>
323
+ <div class="design-option" data-design="gold">
324
+ <div class="color-block" style="background: linear-gradient(45deg, #f6d365, #fda085);"></div>
325
  </div>
326
+ <div class="design-option" data-design="green">
327
+ <div class="color-block" style="background: linear-gradient(45deg, #43c6ac, #f8ffae);"></div>
328
  </div>
329
+ <div class="design-option" data-design="black">
330
+ <div class="color-block" style="background: linear-gradient(45deg, #232526, #414345);"></div>
331
  </div>
332
  </div>
333
  </div>
 
380
  </div>
381
 
382
  <script>
383
+ // Define nail colors and their properties
384
+ const nailDesigns = {
385
+ pink: {
386
+ color: 'linear-gradient(45deg, #ff9a9e, #fad0c4)',
387
+ shadowColor: 'rgba(255, 154, 158, 0.5)'
388
  },
389
+ blue: {
390
+ color: 'linear-gradient(45deg, #2193b0, #6dd5ed)',
391
+ shadowColor: 'rgba(33, 147, 176, 0.5)'
392
  },
393
+ purple: {
394
+ color: 'linear-gradient(45deg, #c471f5, #fa71cd)',
395
+ shadowColor: 'rgba(196, 113, 245, 0.5)'
396
  },
397
+ gold: {
398
+ color: 'linear-gradient(45deg, #f6d365, #fda085)',
399
+ shadowColor: 'rgba(246, 211, 101, 0.5)'
400
  },
401
+ green: {
402
+ color: 'linear-gradient(45deg, #43c6ac, #f8ffae)',
403
+ shadowColor: 'rgba(67, 198, 172, 0.5)'
404
  },
405
+ black: {
406
+ color: 'linear-gradient(45deg, #232526, #414345)',
407
+ shadowColor: 'rgba(35, 37, 38, 0.5)'
408
  }
409
  };
410
 
411
+ // Hide loading screen when page is ready
412
+ document.addEventListener('DOMContentLoaded', function() {
413
+ document.querySelector('.loading-screen').style.opacity = 0;
414
+ setTimeout(() => {
415
+ document.querySelector('.loading-screen').style.display = 'none';
416
+ }, 500);
417
+ });
 
 
 
 
 
 
 
 
 
 
 
 
418
 
419
  // Initialize variables
420
+ let currentDesign = 'pink';
421
  let sizeScale = 1.0;
422
  let lengthScale = 1.0;
423
+ let opacity = 1.0; // Fixed variable name to avoid duplicate
424
  let showShadows = true;
425
  let showLines = false;
426
  let facingMode = 'environment'; // 'user' = front camera, 'environment' = back camera
 
456
  });
457
 
458
  opacitySlider.addEventListener('input', (e) => {
459
+ opacity = parseInt(e.target.value) / 100;
460
  opacityValue.textContent = `${e.target.value}%`;
461
  });
462
 
 
529
  // Draw nail shadow if enabled
530
  if (showShadows) {
531
  ctx.save();
532
+ ctx.shadowColor = nailDesigns[design].shadowColor;
533
  ctx.shadowBlur = 15;
534
  ctx.shadowOffsetX = 0;
535
  ctx.shadowOffsetY = 5;
 
545
  ctx.ellipse(0, 0, nailWidth/2, nailLength/2, 0, 0, Math.PI * 2);
546
  ctx.clip();
547
 
548
+ // Create gradient for the nail color
549
+ const gradient = ctx.createLinearGradient(-nailWidth/2, -nailLength/2, nailWidth/2, nailLength/2);
550
+
551
+ // Parse gradient colors from the design
552
+ const gradientStr = nailDesigns[design].color;
553
+ const colorStart = gradientStr.substring(
554
+ gradientStr.indexOf('(') + 1,
555
+ gradientStr.indexOf(',')
556
+ ).trim();
557
+ const colorEnd = gradientStr.substring(
558
+ gradientStr.lastIndexOf(',') + 1,
559
+ gradientStr.lastIndexOf(')')
560
+ ).trim();
561
+
562
+ gradient.addColorStop(0, colorStart);
563
+ gradient.addColorStop(1, colorEnd);
564
+
565
+ // Draw the nail design with gradient
566
+ ctx.globalAlpha = opacity;
567
+ ctx.fillStyle = gradient;
568
+ ctx.fillRect(-nailWidth/2, -nailLength/2, nailWidth, nailLength);
569
 
570
  // Restore context
571
  ctx.restore();