Update index.html
Browse files- 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="
|
| 316 |
-
<
|
| 317 |
</div>
|
| 318 |
-
<div class="design-option" data-design="
|
| 319 |
-
<
|
| 320 |
</div>
|
| 321 |
-
<div class="design-option" data-design="
|
| 322 |
-
<
|
| 323 |
</div>
|
| 324 |
-
<div class="design-option" data-design="
|
| 325 |
-
<
|
| 326 |
</div>
|
| 327 |
-
<div class="design-option" data-design="
|
| 328 |
-
<
|
| 329 |
</div>
|
| 330 |
-
<div class="design-option" data-design="
|
| 331 |
-
<
|
| 332 |
</div>
|
| 333 |
</div>
|
| 334 |
</div>
|
|
@@ -381,59 +380,47 @@
|
|
| 381 |
</div>
|
| 382 |
|
| 383 |
<script>
|
| 384 |
-
// Define nail
|
| 385 |
-
const
|
| 386 |
-
|
| 387 |
-
|
| 388 |
-
shadowColor: 'rgba(255,
|
| 389 |
},
|
| 390 |
-
|
| 391 |
-
|
| 392 |
-
shadowColor: 'rgba(
|
| 393 |
},
|
| 394 |
-
|
| 395 |
-
|
| 396 |
-
shadowColor: 'rgba(
|
| 397 |
},
|
| 398 |
-
|
| 399 |
-
|
| 400 |
-
shadowColor: 'rgba(
|
| 401 |
},
|
| 402 |
-
|
| 403 |
-
|
| 404 |
-
shadowColor: 'rgba(
|
| 405 |
},
|
| 406 |
-
|
| 407 |
-
|
| 408 |
-
shadowColor: 'rgba(
|
| 409 |
}
|
| 410 |
};
|
| 411 |
|
| 412 |
-
//
|
| 413 |
-
|
| 414 |
-
|
| 415 |
-
|
| 416 |
-
|
| 417 |
-
|
| 418 |
-
|
| 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 = '
|
| 434 |
let sizeScale = 1.0;
|
| 435 |
let lengthScale = 1.0;
|
| 436 |
-
let
|
| 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 |
-
|
| 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 =
|
| 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 |
-
//
|
| 562 |
-
ctx.
|
| 563 |
-
|
| 564 |
-
|
| 565 |
-
|
| 566 |
-
|
| 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();
|