Update index.html
Browse files- index.html +13 -12
index.html
CHANGED
|
@@ -9,7 +9,8 @@
|
|
| 9 |
<style>
|
| 10 |
/* Confetti Keyframes: Start at bottom, burst up, then fall (simulating gravity) */
|
| 11 |
@keyframes confetti-burst-fall {
|
| 12 |
-
|
|
|
|
| 13 |
10% { transform: translateY(-40vh) translateX(var(--confetti-initial-x)) rotate(180deg); opacity: 1; } /* Initial upward burst */
|
| 14 |
100% { transform: translateY(100vh) translateX(var(--confetti-end-x-offset)) rotate(1080deg); opacity: 0.5; }
|
| 15 |
}
|
|
@@ -58,24 +59,23 @@
|
|
| 58 |
border-right: 15px solid transparent;
|
| 59 |
border-top: 30px solid #fcd34d; /* Yellow arrow */
|
| 60 |
z-index: 20;
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3), inset 0 3px 0 rgba(255, 255, 255, 0.2);
|
| 64 |
transition: transform 0.1s;
|
| 65 |
}
|
| 66 |
|
| 67 |
-
.wheel-center-dot { /*
|
| 68 |
position: absolute;
|
| 69 |
top: 50%;
|
| 70 |
left: 50%;
|
| 71 |
transform: translate(-50%, -50%);
|
| 72 |
-
width:
|
| 73 |
-
height:
|
| 74 |
border-radius: 50%;
|
| 75 |
background: #fcd34d; /* Yellow */
|
| 76 |
border: 4px solid #1f2937; /* Dark border to contrast */
|
| 77 |
box-shadow: 0 0 10px rgba(255, 255, 255, 0.4);
|
| 78 |
-
z-index:
|
| 79 |
pointer-events: none;
|
| 80 |
}
|
| 81 |
|
|
@@ -92,7 +92,7 @@
|
|
| 92 |
justify-content: center;
|
| 93 |
text-align: center;
|
| 94 |
pointer-events: none;
|
| 95 |
-
z-index:
|
| 96 |
}
|
| 97 |
|
| 98 |
.segment-text {
|
|
@@ -253,7 +253,8 @@
|
|
| 253 |
// Initial horizontal position (centered burst)
|
| 254 |
const startX = window.innerWidth / 2 + (Math.random() - 0.5) * 400;
|
| 255 |
c.style.left = `${startX}px`;
|
| 256 |
-
|
|
|
|
| 257 |
|
| 258 |
const duration = Math.random() * 2 + 3; // 3 to 5 seconds
|
| 259 |
const delay = Math.random() * 0.5;
|
|
@@ -508,10 +509,10 @@
|
|
| 508 |
// 1. 禁用 CSS transition
|
| 509 |
spinningWheel.style.transition = 'none';
|
| 510 |
|
| 511 |
-
// 2. 應用最終旋轉角度 (
|
| 512 |
spinningWheel.style.transform = `rotate(${currentRotation % 360}deg)`;
|
| 513 |
|
| 514 |
-
// 3. 顯示中獎者疊層
|
| 515 |
overlayText.textContent = `${winner.id} - ${winner.name}`;
|
| 516 |
winnerOverlay.classList.remove('opacity-0');
|
| 517 |
winnerOverlay.classList.add('opacity-100', 'animate-flash');
|
|
|
|
| 9 |
<style>
|
| 10 |
/* Confetti Keyframes: Start at bottom, burst up, then fall (simulating gravity) */
|
| 11 |
@keyframes confetti-burst-fall {
|
| 12 |
+
/* FIX 1: 確保起始可見 (opacity 1) 且從底部開始相對位移 */
|
| 13 |
+
0% { transform: translateY(0) translateX(0) rotate(0deg); opacity: 1; }
|
| 14 |
10% { transform: translateY(-40vh) translateX(var(--confetti-initial-x)) rotate(180deg); opacity: 1; } /* Initial upward burst */
|
| 15 |
100% { transform: translateY(100vh) translateX(var(--confetti-end-x-offset)) rotate(1080deg); opacity: 0.5; }
|
| 16 |
}
|
|
|
|
| 59 |
border-right: 15px solid transparent;
|
| 60 |
border-top: 30px solid #fcd34d; /* Yellow arrow */
|
| 61 |
z-index: 20;
|
| 62 |
+
/* FIX 2: 移除 box-shadow,只保留 drop-shadow 修正方形陰影問題 */
|
| 63 |
+
filter: drop-shadow(0 0 5px rgba(0, 0, 0, 0.5)) drop-shadow(0 4px 6px rgba(0, 0, 0, 0.3));
|
|
|
|
| 64 |
transition: transform 0.1s;
|
| 65 |
}
|
| 66 |
|
| 67 |
+
.wheel-center-dot { /* FIX 3: 縮小尺寸 */
|
| 68 |
position: absolute;
|
| 69 |
top: 50%;
|
| 70 |
left: 50%;
|
| 71 |
transform: translate(-50%, -50%);
|
| 72 |
+
width: 20px; /* 縮小 */
|
| 73 |
+
height: 20px; /* 縮小 */
|
| 74 |
border-radius: 50%;
|
| 75 |
background: #fcd34d; /* Yellow */
|
| 76 |
border: 4px solid #1f2937; /* Dark border to contrast */
|
| 77 |
box-shadow: 0 0 10px rgba(255, 255, 255, 0.4);
|
| 78 |
+
z-index: 19; /* 降低 Z-index,讓 Overlay 蓋在上面 */
|
| 79 |
pointer-events: none;
|
| 80 |
}
|
| 81 |
|
|
|
|
| 92 |
justify-content: center;
|
| 93 |
text-align: center;
|
| 94 |
pointer-events: none;
|
| 95 |
+
z-index: 25; /* FIX 3: 提高 Z-index,確保結果可見 */
|
| 96 |
}
|
| 97 |
|
| 98 |
.segment-text {
|
|
|
|
| 253 |
// Initial horizontal position (centered burst)
|
| 254 |
const startX = window.innerWidth / 2 + (Math.random() - 0.5) * 400;
|
| 255 |
c.style.left = `${startX}px`;
|
| 256 |
+
// FIX 1: 使用 100vh 確保起始點在視窗底部邊緣 (為了解決 confetti 不見的問題)
|
| 257 |
+
c.style.top = `100vh`;
|
| 258 |
|
| 259 |
const duration = Math.random() * 2 + 3; // 3 to 5 seconds
|
| 260 |
const delay = Math.random() * 0.5;
|
|
|
|
| 509 |
// 1. 禁用 CSS transition
|
| 510 |
spinningWheel.style.transition = 'none';
|
| 511 |
|
| 512 |
+
// 2. 應用最終旋轉角度 (确保最终靜止位置正確)
|
| 513 |
spinningWheel.style.transform = `rotate(${currentRotation % 360}deg)`;
|
| 514 |
|
| 515 |
+
// 3. 顯示中獎者疊層
|
| 516 |
overlayText.textContent = `${winner.id} - ${winner.name}`;
|
| 517 |
winnerOverlay.classList.remove('opacity-0');
|
| 518 |
winnerOverlay.classList.add('opacity-100', 'animate-flash');
|