Add 1 files
Browse files- index.html +172 -182
index.html
CHANGED
|
@@ -2,8 +2,8 @@
|
|
| 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>
|
| 7 |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
| 8 |
<style>
|
| 9 |
* {
|
|
@@ -11,68 +11,69 @@
|
|
| 11 |
padding: 0;
|
| 12 |
box-sizing: border-box;
|
| 13 |
font-family: 'Arial', sans-serif;
|
|
|
|
| 14 |
}
|
| 15 |
|
| 16 |
body {
|
| 17 |
background: linear-gradient(135deg, #1a1a2e, #16213e, #0f3460);
|
| 18 |
color: white;
|
| 19 |
-
height: 100vh;
|
| 20 |
display: flex;
|
| 21 |
flex-direction: column;
|
| 22 |
justify-content: center;
|
| 23 |
align-items: center;
|
| 24 |
overflow: hidden;
|
| 25 |
position: relative;
|
|
|
|
| 26 |
}
|
| 27 |
|
| 28 |
.timer-container {
|
| 29 |
text-align: center;
|
| 30 |
z-index: 1;
|
| 31 |
-
padding:
|
| 32 |
background: rgba(255, 255, 255, 0.1);
|
| 33 |
border-radius: 20px;
|
| 34 |
backdrop-filter: blur(10px);
|
| 35 |
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
|
| 36 |
border: 1px solid rgba(255, 255, 255, 0.1);
|
| 37 |
-
|
|
|
|
| 38 |
transition: all 0.3s ease;
|
| 39 |
-
margin
|
| 40 |
-
}
|
| 41 |
-
|
| 42 |
-
.timer-container:hover {
|
| 43 |
-
transform: scale(1.02);
|
| 44 |
}
|
| 45 |
|
| 46 |
h1 {
|
| 47 |
-
font-size: 2.5rem;
|
| 48 |
-
margin-bottom:
|
| 49 |
text-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
|
| 50 |
letter-spacing: 1px;
|
| 51 |
}
|
| 52 |
|
| 53 |
.timer {
|
| 54 |
display: flex;
|
| 55 |
-
justify-content:
|
| 56 |
-
gap:
|
| 57 |
-
margin-bottom:
|
| 58 |
}
|
| 59 |
|
| 60 |
.time-box {
|
| 61 |
position: relative;
|
| 62 |
-
width:
|
| 63 |
-
|
|
|
|
|
|
|
| 64 |
perspective: 1000px;
|
| 65 |
}
|
| 66 |
|
| 67 |
.time-value {
|
| 68 |
position: absolute;
|
| 69 |
width: 100%;
|
| 70 |
-
height:
|
|
|
|
| 71 |
display: flex;
|
| 72 |
-
flex-direction: column;
|
| 73 |
justify-content: center;
|
| 74 |
align-items: center;
|
| 75 |
-
font-size: 5rem;
|
| 76 |
font-weight: bold;
|
| 77 |
background: rgba(255, 255, 255, 0.1);
|
| 78 |
border-radius: 10px;
|
|
@@ -80,7 +81,6 @@
|
|
| 80 |
transition: all 0.3s ease;
|
| 81 |
backface-visibility: hidden;
|
| 82 |
transform-style: preserve-3d;
|
| 83 |
-
top: 0;
|
| 84 |
}
|
| 85 |
|
| 86 |
.time-value.flip {
|
|
@@ -100,25 +100,39 @@
|
|
| 100 |
position: absolute;
|
| 101 |
bottom: 0;
|
| 102 |
width: 100%;
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
font-size: 1.2rem;
|
| 106 |
opacity: 0.8;
|
| 107 |
text-transform: uppercase;
|
| 108 |
-
letter-spacing:
|
| 109 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 110 |
}
|
| 111 |
|
| 112 |
.controls {
|
| 113 |
display: flex;
|
| 114 |
-
gap:
|
| 115 |
justify-content: center;
|
| 116 |
-
margin-top:
|
| 117 |
}
|
| 118 |
|
| 119 |
button {
|
| 120 |
-
padding: 0.
|
| 121 |
-
font-size: 1rem;
|
| 122 |
background: rgba(255, 255, 255, 0.2);
|
| 123 |
color: white;
|
| 124 |
border: none;
|
|
@@ -129,41 +143,55 @@
|
|
| 129 |
align-items: center;
|
| 130 |
gap: 0.5rem;
|
| 131 |
backdrop-filter: blur(5px);
|
|
|
|
|
|
|
|
|
|
|
|
|
| 132 |
}
|
| 133 |
|
| 134 |
-
button:
|
| 135 |
-
|
| 136 |
-
transform: translateY(-3px);
|
| 137 |
}
|
| 138 |
|
| 139 |
-
button
|
| 140 |
-
|
| 141 |
}
|
| 142 |
|
| 143 |
.set-timer {
|
| 144 |
display: flex;
|
| 145 |
-
gap:
|
| 146 |
-
margin-top:
|
| 147 |
justify-content: center;
|
| 148 |
align-items: center;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 149 |
}
|
| 150 |
|
| 151 |
.time-input {
|
| 152 |
position: relative;
|
|
|
|
| 153 |
}
|
| 154 |
|
| 155 |
.time-input input {
|
| 156 |
-
padding: 0.
|
| 157 |
-
width:
|
| 158 |
text-align: center;
|
| 159 |
background: rgba(255, 255, 255, 0.1);
|
| 160 |
border: 1px solid rgba(255, 255, 255, 0.2);
|
| 161 |
border-radius: 5px;
|
| 162 |
color: white;
|
| 163 |
-
font-size: 1.5rem;
|
| 164 |
font-weight: bold;
|
| 165 |
appearance: textfield;
|
| 166 |
-moz-appearance: textfield;
|
|
|
|
| 167 |
}
|
| 168 |
|
| 169 |
.time-input input::-webkit-outer-spin-button,
|
|
@@ -174,37 +202,24 @@
|
|
| 174 |
|
| 175 |
.arrows {
|
| 176 |
position: absolute;
|
| 177 |
-
right:
|
| 178 |
-
display: flex;
|
| 179 |
-
flex-direction: column;
|
| 180 |
-
gap: 0;
|
| 181 |
-
height: 100%;
|
| 182 |
top: 0;
|
|
|
|
| 183 |
pointer-events: none;
|
|
|
|
|
|
|
|
|
|
| 184 |
}
|
| 185 |
|
| 186 |
.arrow-btn {
|
| 187 |
position: relative;
|
| 188 |
width: 20px;
|
| 189 |
-
height: 50%;
|
| 190 |
padding: 0;
|
| 191 |
background: transparent;
|
| 192 |
border: none;
|
| 193 |
cursor: pointer;
|
| 194 |
pointer-events: all;
|
| 195 |
-
display: flex;
|
| 196 |
-
align-items: center;
|
| 197 |
-
justify-content: center;
|
| 198 |
-
}
|
| 199 |
-
|
| 200 |
-
.arrow-btn.up {
|
| 201 |
-
top: 0;
|
| 202 |
-
border-radius: 0 5px 0 0;
|
| 203 |
-
}
|
| 204 |
-
|
| 205 |
-
.arrow-btn.down {
|
| 206 |
-
bottom: 0;
|
| 207 |
-
border-radius: 0 0 5px 0;
|
| 208 |
}
|
| 209 |
|
| 210 |
.arrow-btn:after {
|
|
@@ -214,100 +229,22 @@
|
|
| 214 |
border-left: 5px solid transparent;
|
| 215 |
border-right: 5px solid transparent;
|
| 216 |
border-bottom: 5px solid white;
|
| 217 |
-
|
|
|
|
|
|
|
|
|
|
| 218 |
opacity: 0.7;
|
| 219 |
}
|
| 220 |
|
| 221 |
.arrow-btn.down:after {
|
| 222 |
-
transform: rotate(180deg);
|
| 223 |
-
}
|
| 224 |
-
|
| 225 |
-
.arrow-btn:hover:after {
|
| 226 |
-
opacity: 1;
|
| 227 |
-
transform: scale(1.2);
|
| 228 |
-
}
|
| 229 |
-
|
| 230 |
-
.arrow-btn.down:hover:after {
|
| 231 |
-
transform: rotate(180deg) scale(1.2);
|
| 232 |
-
}
|
| 233 |
-
|
| 234 |
-
.time-input-wrapper {
|
| 235 |
-
display: flex;
|
| 236 |
-
flex-direction: column;
|
| 237 |
-
align-items: center;
|
| 238 |
}
|
| 239 |
|
| 240 |
.time-label-input {
|
| 241 |
-
margin-top:
|
| 242 |
-
font-size: 1rem;
|
| 243 |
opacity: 0.8;
|
| 244 |
text-transform: uppercase;
|
| 245 |
-
letter-spacing: 1px;
|
| 246 |
-
}
|
| 247 |
-
|
| 248 |
-
/* Responsive adjustments */
|
| 249 |
-
@media (max-width: 768px) {
|
| 250 |
-
.timer {
|
| 251 |
-
flex-wrap: wrap;
|
| 252 |
-
}
|
| 253 |
-
.time-box {
|
| 254 |
-
width: 80px;
|
| 255 |
-
height: 140px;
|
| 256 |
-
}
|
| 257 |
-
.time-value {
|
| 258 |
-
font-size: 3rem;
|
| 259 |
-
height: 80px;
|
| 260 |
-
}
|
| 261 |
-
.time-label {
|
| 262 |
-
font-size: 1rem;
|
| 263 |
-
margin-top: 2rem;
|
| 264 |
-
}
|
| 265 |
-
h1 {
|
| 266 |
-
font-size: 2rem;
|
| 267 |
-
}
|
| 268 |
-
.time-input input {
|
| 269 |
-
width: 80px;
|
| 270 |
-
font-size: 1.2rem;
|
| 271 |
-
}
|
| 272 |
-
.time-label-input {
|
| 273 |
-
margin-top: 0.8rem;
|
| 274 |
-
}
|
| 275 |
-
}
|
| 276 |
-
|
| 277 |
-
@media (max-width: 480px) {
|
| 278 |
-
.time-box {
|
| 279 |
-
width: 60px;
|
| 280 |
-
height: 120px;
|
| 281 |
-
}
|
| 282 |
-
.time-value {
|
| 283 |
-
font-size: 2rem;
|
| 284 |
-
height: 60px;
|
| 285 |
-
}
|
| 286 |
-
.time-label {
|
| 287 |
-
font-size: 0.8rem;
|
| 288 |
-
margin-top: 1.5rem;
|
| 289 |
-
}
|
| 290 |
-
button {
|
| 291 |
-
padding: 0.6rem 1rem;
|
| 292 |
-
font-size: 0.9rem;
|
| 293 |
-
}
|
| 294 |
-
.set-timer {
|
| 295 |
-
flex-direction: column;
|
| 296 |
-
}
|
| 297 |
-
.time-input input {
|
| 298 |
-
width: 100px;
|
| 299 |
-
}
|
| 300 |
-
.time-label-input {
|
| 301 |
-
margin-top: 0.6rem;
|
| 302 |
-
}
|
| 303 |
-
}
|
| 304 |
-
|
| 305 |
-
.confetti {
|
| 306 |
-
position: absolute;
|
| 307 |
-
width: 10px;
|
| 308 |
-
height: 10px;
|
| 309 |
-
background: #f00;
|
| 310 |
-
opacity: 0;
|
| 311 |
}
|
| 312 |
|
| 313 |
.modal {
|
|
@@ -330,9 +267,11 @@
|
|
| 330 |
padding: 2rem;
|
| 331 |
border-radius: 15px;
|
| 332 |
text-align: center;
|
| 333 |
-
|
|
|
|
| 334 |
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
|
| 335 |
position: relative;
|
|
|
|
| 336 |
}
|
| 337 |
|
| 338 |
.close-modal {
|
|
@@ -340,8 +279,8 @@
|
|
| 340 |
top: -10px;
|
| 341 |
right: -10px;
|
| 342 |
background: #ff6b6b;
|
| 343 |
-
width:
|
| 344 |
-
height:
|
| 345 |
border-radius: 50%;
|
| 346 |
display: flex;
|
| 347 |
justify-content: center;
|
|
@@ -350,41 +289,76 @@
|
|
| 350 |
transition: all 0.3s ease;
|
| 351 |
}
|
| 352 |
|
| 353 |
-
.close-modal
|
| 354 |
-
|
| 355 |
}
|
| 356 |
|
| 357 |
.modal h2 {
|
| 358 |
-
font-size: 3rem;
|
| 359 |
margin-bottom: 1rem;
|
| 360 |
color: #ff6b6b;
|
| 361 |
-
text-shadow: 0 0 10px rgba(255, 107, 107, 0.5);
|
| 362 |
}
|
| 363 |
|
| 364 |
.modal p {
|
| 365 |
-
font-size: 1.2rem;
|
| 366 |
margin-bottom: 1.5rem;
|
| 367 |
}
|
| 368 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 369 |
@keyframes fadeIn {
|
| 370 |
from { opacity: 0; }
|
| 371 |
to { opacity: 1; }
|
| 372 |
}
|
| 373 |
|
| 374 |
-
.
|
| 375 |
-
|
| 376 |
-
|
| 377 |
-
|
| 378 |
-
|
| 379 |
-
|
| 380 |
-
|
| 381 |
}
|
| 382 |
|
| 383 |
-
|
| 384 |
-
|
| 385 |
-
|
| 386 |
-
|
| 387 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 388 |
}
|
| 389 |
</style>
|
| 390 |
</head>
|
|
@@ -423,7 +397,7 @@
|
|
| 423 |
<div class="time-input">
|
| 424 |
<input type="number" id="inputHours" min="0" max="99" value="0">
|
| 425 |
<div class="arrows">
|
| 426 |
-
<button class="arrow-btn
|
| 427 |
<button class="arrow-btn down" onclick="decrementHours()"></button>
|
| 428 |
</div>
|
| 429 |
</div>
|
|
@@ -433,7 +407,7 @@
|
|
| 433 |
<div class="time-input">
|
| 434 |
<input type="number" id="inputMinutes" min="0" max="59" value="10">
|
| 435 |
<div class="arrows">
|
| 436 |
-
<button class="arrow-btn
|
| 437 |
<button class="arrow-btn down" onclick="decrementMinutes()"></button>
|
| 438 |
</div>
|
| 439 |
</div>
|
|
@@ -443,7 +417,7 @@
|
|
| 443 |
<div class="time-input">
|
| 444 |
<input type="number" id="inputSeconds" min="0" max="59" value="0">
|
| 445 |
<div class="arrows">
|
| 446 |
-
<button class="arrow-btn
|
| 447 |
<button class="arrow-btn down" onclick="decrementSeconds()"></button>
|
| 448 |
</div>
|
| 449 |
</div>
|
|
@@ -459,7 +433,7 @@
|
|
| 459 |
</div>
|
| 460 |
<h2>Time's Up!</h2>
|
| 461 |
<p>Your countdown has reached zero.</p>
|
| 462 |
-
<button id="newTimerBtn"><i class="fas fa-plus"></i>
|
| 463 |
</div>
|
| 464 |
</div>
|
| 465 |
|
|
@@ -488,12 +462,12 @@
|
|
| 488 |
|
| 489 |
// Create particles
|
| 490 |
function createParticles() {
|
| 491 |
-
for (let i = 0; i <
|
| 492 |
const particle = document.createElement('div');
|
| 493 |
particle.className = 'confetti';
|
| 494 |
particle.style.left = `${Math.random() * 100}vw`;
|
| 495 |
particle.style.top = `${Math.random() * 100}vh`;
|
| 496 |
-
particle.style.width = `${5 + Math.random() *
|
| 497 |
particle.style.height = particle.style.width;
|
| 498 |
particle.style.backgroundColor = `hsl(${Math.random() * 360}, 100%, 50%)`;
|
| 499 |
particles.appendChild(particle);
|
|
@@ -516,8 +490,6 @@
|
|
| 516 |
hoursElement.textContent = hours.toString().padStart(2, '0');
|
| 517 |
hoursElement.classList.remove('flip');
|
| 518 |
}, 300);
|
| 519 |
-
} else {
|
| 520 |
-
hoursElement.textContent = hours.toString().padStart(2, '0');
|
| 521 |
}
|
| 522 |
|
| 523 |
if (minutesElement.textContent !== minutes.toString().padStart(2, '0')) {
|
|
@@ -526,8 +498,6 @@
|
|
| 526 |
minutesElement.textContent = minutes.toString().padStart(2, '0');
|
| 527 |
minutesElement.classList.remove('flip');
|
| 528 |
}, 300);
|
| 529 |
-
} else {
|
| 530 |
-
minutesElement.textContent = minutes.toString().padStart(2, '0');
|
| 531 |
}
|
| 532 |
|
| 533 |
if (secondsElement.textContent !== secs.toString().padStart(2, '0')) {
|
|
@@ -536,8 +506,6 @@
|
|
| 536 |
secondsElement.textContent = secs.toString().padStart(2, '0');
|
| 537 |
secondsElement.classList.remove('flip');
|
| 538 |
}, 300);
|
| 539 |
-
} else {
|
| 540 |
-
secondsElement.textContent = secs.toString().padStart(2, '0');
|
| 541 |
}
|
| 542 |
|
| 543 |
// Update progress bar
|
|
@@ -563,7 +531,7 @@
|
|
| 563 |
const seconds = parseInt(inputSeconds.value) || 0;
|
| 564 |
|
| 565 |
if (hours === 0 && minutes === 0 && seconds === 0) {
|
| 566 |
-
alert('Please set a valid time before starting
|
| 567 |
return;
|
| 568 |
}
|
| 569 |
|
|
@@ -573,7 +541,7 @@
|
|
| 573 |
isRunning = true;
|
| 574 |
updateDisplay(remainingSeconds);
|
| 575 |
|
| 576 |
-
countdownInterval = setInterval(() {
|
| 577 |
remainingSeconds--;
|
| 578 |
|
| 579 |
if (remainingSeconds < 0) {
|
|
@@ -617,6 +585,11 @@
|
|
| 617 |
// Close modal
|
| 618 |
function closeModalFunc() {
|
| 619 |
modal.style.display = 'none';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 620 |
}
|
| 621 |
|
| 622 |
// Start new timer
|
|
@@ -634,13 +607,11 @@
|
|
| 634 |
confettiElements.forEach((el, index) => {
|
| 635 |
setTimeout(() => {
|
| 636 |
el.style.opacity = '1';
|
| 637 |
-
el.style.transform = `translate(${(Math.random() - 0.5) *
|
| 638 |
el.style.transition = 'all 1s ease';
|
| 639 |
|
| 640 |
setTimeout(() => {
|
| 641 |
el.style.opacity = '0';
|
| 642 |
-
el.style.transform = 'translate(0, 0) rotate(0deg)';
|
| 643 |
-
el.style.transition = 'none';
|
| 644 |
}, 1000);
|
| 645 |
}, index * 50);
|
| 646 |
});
|
|
@@ -681,15 +652,34 @@
|
|
| 681 |
else inputSeconds.value = 59;
|
| 682 |
}
|
| 683 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 684 |
// Event listeners
|
| 685 |
startBtn.addEventListener('click', startCountdown);
|
| 686 |
pauseBtn.addEventListener('click', pauseCountdown);
|
| 687 |
resetBtn.addEventListener('click', resetCountdown);
|
| 688 |
closeModal.addEventListener('click', closeModalFunc);
|
| 689 |
newTimerBtn.addEventListener('click', startNewTimer);
|
|
|
|
|
|
|
|
|
|
| 690 |
|
| 691 |
// Initialize with default time
|
| 692 |
resetCountdown();
|
| 693 |
</script>
|
| 694 |
-
<
|
| 695 |
</html>
|
|
|
|
| 2 |
<html lang="en">
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
| 6 |
+
<title>Countdown Timer</title>
|
| 7 |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
| 8 |
<style>
|
| 9 |
* {
|
|
|
|
| 11 |
padding: 0;
|
| 12 |
box-sizing: border-box;
|
| 13 |
font-family: 'Arial', sans-serif;
|
| 14 |
+
-webkit-tap-highlight-color: transparent;
|
| 15 |
}
|
| 16 |
|
| 17 |
body {
|
| 18 |
background: linear-gradient(135deg, #1a1a2e, #16213e, #0f3460);
|
| 19 |
color: white;
|
| 20 |
+
min-height: 100vh;
|
| 21 |
display: flex;
|
| 22 |
flex-direction: column;
|
| 23 |
justify-content: center;
|
| 24 |
align-items: center;
|
| 25 |
overflow: hidden;
|
| 26 |
position: relative;
|
| 27 |
+
touch-action: manipulation;
|
| 28 |
}
|
| 29 |
|
| 30 |
.timer-container {
|
| 31 |
text-align: center;
|
| 32 |
z-index: 1;
|
| 33 |
+
padding: 1.5rem;
|
| 34 |
background: rgba(255, 255, 255, 0.1);
|
| 35 |
border-radius: 20px;
|
| 36 |
backdrop-filter: blur(10px);
|
| 37 |
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
|
| 38 |
border: 1px solid rgba(255, 255, 255, 0.1);
|
| 39 |
+
width: 95%;
|
| 40 |
+
max-width: 600px;
|
| 41 |
transition: all 0.3s ease;
|
| 42 |
+
margin: 1rem;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
}
|
| 44 |
|
| 45 |
h1 {
|
| 46 |
+
font-size: clamp(1.5rem, 5vw, 2.5rem);
|
| 47 |
+
margin-bottom: 1.5rem;
|
| 48 |
text-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
|
| 49 |
letter-spacing: 1px;
|
| 50 |
}
|
| 51 |
|
| 52 |
.timer {
|
| 53 |
display: flex;
|
| 54 |
+
justify-content: space-around;
|
| 55 |
+
gap: 0.5rem;
|
| 56 |
+
margin-bottom: 1.5rem;
|
| 57 |
}
|
| 58 |
|
| 59 |
.time-box {
|
| 60 |
position: relative;
|
| 61 |
+
width: 30%;
|
| 62 |
+
max-width: 120px;
|
| 63 |
+
min-width: 70px;
|
| 64 |
+
aspect-ratio: 0.7;
|
| 65 |
perspective: 1000px;
|
| 66 |
}
|
| 67 |
|
| 68 |
.time-value {
|
| 69 |
position: absolute;
|
| 70 |
width: 100%;
|
| 71 |
+
height: 70%;
|
| 72 |
+
top: 0;
|
| 73 |
display: flex;
|
|
|
|
| 74 |
justify-content: center;
|
| 75 |
align-items: center;
|
| 76 |
+
font-size: clamp(2.5rem, 8vw, 5rem);
|
| 77 |
font-weight: bold;
|
| 78 |
background: rgba(255, 255, 255, 0.1);
|
| 79 |
border-radius: 10px;
|
|
|
|
| 81 |
transition: all 0.3s ease;
|
| 82 |
backface-visibility: hidden;
|
| 83 |
transform-style: preserve-3d;
|
|
|
|
| 84 |
}
|
| 85 |
|
| 86 |
.time-value.flip {
|
|
|
|
| 100 |
position: absolute;
|
| 101 |
bottom: 0;
|
| 102 |
width: 100%;
|
| 103 |
+
padding-top: 1rem;
|
| 104 |
+
font-size: clamp(0.8rem, 3vw, 1.2rem);
|
|
|
|
| 105 |
opacity: 0.8;
|
| 106 |
text-transform: uppercase;
|
| 107 |
+
letter-spacing: 1px;
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
.progress-bar {
|
| 111 |
+
width: 100%;
|
| 112 |
+
height: 6px;
|
| 113 |
+
background: rgba(255, 255, 255, 0.1);
|
| 114 |
+
border-radius: 3px;
|
| 115 |
+
margin: 1rem 0;
|
| 116 |
+
overflow: hidden;
|
| 117 |
+
}
|
| 118 |
+
|
| 119 |
+
.progress {
|
| 120 |
+
height: 100%;
|
| 121 |
+
background: linear-gradient(90deg, #ff6b6b, #ff8e8e);
|
| 122 |
+
width: 100%;
|
| 123 |
+
transition: width 0.3s ease;
|
| 124 |
}
|
| 125 |
|
| 126 |
.controls {
|
| 127 |
display: flex;
|
| 128 |
+
gap: 0.5rem;
|
| 129 |
justify-content: center;
|
| 130 |
+
margin-top: 1rem;
|
| 131 |
}
|
| 132 |
|
| 133 |
button {
|
| 134 |
+
padding: 0.7rem 1.2rem;
|
| 135 |
+
font-size: clamp(0.9rem, 3.5vw, 1rem);
|
| 136 |
background: rgba(255, 255, 255, 0.2);
|
| 137 |
color: white;
|
| 138 |
border: none;
|
|
|
|
| 143 |
align-items: center;
|
| 144 |
gap: 0.5rem;
|
| 145 |
backdrop-filter: blur(5px);
|
| 146 |
+
flex: 1;
|
| 147 |
+
max-width: 120px;
|
| 148 |
+
justify-content: center;
|
| 149 |
+
user-select: none;
|
| 150 |
}
|
| 151 |
|
| 152 |
+
button:active {
|
| 153 |
+
transform: scale(0.95);
|
|
|
|
| 154 |
}
|
| 155 |
|
| 156 |
+
button i {
|
| 157 |
+
font-size: 1rem;
|
| 158 |
}
|
| 159 |
|
| 160 |
.set-timer {
|
| 161 |
display: flex;
|
| 162 |
+
gap: 0.5rem;
|
| 163 |
+
margin-top: 1.5rem;
|
| 164 |
justify-content: center;
|
| 165 |
align-items: center;
|
| 166 |
+
flex-wrap: wrap;
|
| 167 |
+
}
|
| 168 |
+
|
| 169 |
+
.time-input-wrapper {
|
| 170 |
+
display: flex;
|
| 171 |
+
flex-direction: column;
|
| 172 |
+
align-items: center;
|
| 173 |
+
flex: 1;
|
| 174 |
+
min-width: 80px;
|
| 175 |
}
|
| 176 |
|
| 177 |
.time-input {
|
| 178 |
position: relative;
|
| 179 |
+
width: 100%;
|
| 180 |
}
|
| 181 |
|
| 182 |
.time-input input {
|
| 183 |
+
padding: 0.6rem;
|
| 184 |
+
width: 100%;
|
| 185 |
text-align: center;
|
| 186 |
background: rgba(255, 255, 255, 0.1);
|
| 187 |
border: 1px solid rgba(255, 255, 255, 0.2);
|
| 188 |
border-radius: 5px;
|
| 189 |
color: white;
|
| 190 |
+
font-size: clamp(1rem, 4vw, 1.5rem);
|
| 191 |
font-weight: bold;
|
| 192 |
appearance: textfield;
|
| 193 |
-moz-appearance: textfield;
|
| 194 |
+
min-height: 50px;
|
| 195 |
}
|
| 196 |
|
| 197 |
.time-input input::-webkit-outer-spin-button,
|
|
|
|
| 202 |
|
| 203 |
.arrows {
|
| 204 |
position: absolute;
|
| 205 |
+
right: 5px;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 206 |
top: 0;
|
| 207 |
+
height: 100%;
|
| 208 |
pointer-events: none;
|
| 209 |
+
display: flex;
|
| 210 |
+
flex-direction: column;
|
| 211 |
+
justify-content: space-between;
|
| 212 |
}
|
| 213 |
|
| 214 |
.arrow-btn {
|
| 215 |
position: relative;
|
| 216 |
width: 20px;
|
| 217 |
+
height: calc(50% - 2px);
|
| 218 |
padding: 0;
|
| 219 |
background: transparent;
|
| 220 |
border: none;
|
| 221 |
cursor: pointer;
|
| 222 |
pointer-events: all;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 223 |
}
|
| 224 |
|
| 225 |
.arrow-btn:after {
|
|
|
|
| 229 |
border-left: 5px solid transparent;
|
| 230 |
border-right: 5px solid transparent;
|
| 231 |
border-bottom: 5px solid white;
|
| 232 |
+
position: absolute;
|
| 233 |
+
top: 50%;
|
| 234 |
+
left: 50%;
|
| 235 |
+
transform: translate(-50%, -50%);
|
| 236 |
opacity: 0.7;
|
| 237 |
}
|
| 238 |
|
| 239 |
.arrow-btn.down:after {
|
| 240 |
+
transform: translate(-50%, -50%) rotate(180deg);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 241 |
}
|
| 242 |
|
| 243 |
.time-label-input {
|
| 244 |
+
margin-top: 0.5rem;
|
| 245 |
+
font-size: clamp(0.7rem, 3vw, 1rem);
|
| 246 |
opacity: 0.8;
|
| 247 |
text-transform: uppercase;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 248 |
}
|
| 249 |
|
| 250 |
.modal {
|
|
|
|
| 267 |
padding: 2rem;
|
| 268 |
border-radius: 15px;
|
| 269 |
text-align: center;
|
| 270 |
+
width: 90%;
|
| 271 |
+
max-width: 400px;
|
| 272 |
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
|
| 273 |
position: relative;
|
| 274 |
+
margin: 1rem;
|
| 275 |
}
|
| 276 |
|
| 277 |
.close-modal {
|
|
|
|
| 279 |
top: -10px;
|
| 280 |
right: -10px;
|
| 281 |
background: #ff6b6b;
|
| 282 |
+
width: 30px;
|
| 283 |
+
height: 30px;
|
| 284 |
border-radius: 50%;
|
| 285 |
display: flex;
|
| 286 |
justify-content: center;
|
|
|
|
| 289 |
transition: all 0.3s ease;
|
| 290 |
}
|
| 291 |
|
| 292 |
+
.close-modal i {
|
| 293 |
+
font-size: 0.9rem;
|
| 294 |
}
|
| 295 |
|
| 296 |
.modal h2 {
|
| 297 |
+
font-size: clamp(1.8rem, 6vw, 3rem);
|
| 298 |
margin-bottom: 1rem;
|
| 299 |
color: #ff6b6b;
|
|
|
|
| 300 |
}
|
| 301 |
|
| 302 |
.modal p {
|
| 303 |
+
font-size: clamp(1rem, 4vw, 1.2rem);
|
| 304 |
margin-bottom: 1.5rem;
|
| 305 |
}
|
| 306 |
|
| 307 |
+
#newTimerBtn {
|
| 308 |
+
width: 100%;
|
| 309 |
+
max-width: 200px;
|
| 310 |
+
margin: 0 auto;
|
| 311 |
+
}
|
| 312 |
+
|
| 313 |
@keyframes fadeIn {
|
| 314 |
from { opacity: 0; }
|
| 315 |
to { opacity: 1; }
|
| 316 |
}
|
| 317 |
|
| 318 |
+
.confetti {
|
| 319 |
+
position: absolute;
|
| 320 |
+
width: 10px;
|
| 321 |
+
height: 10px;
|
| 322 |
+
background: #f00;
|
| 323 |
+
opacity: 0;
|
| 324 |
+
pointer-events: none;
|
| 325 |
}
|
| 326 |
|
| 327 |
+
/* Orientation specific adjustments */
|
| 328 |
+
@media (orientation: portrait) and (max-height: 700px) {
|
| 329 |
+
.timer-container {
|
| 330 |
+
padding: 1rem;
|
| 331 |
+
margin-top: 0;
|
| 332 |
+
}
|
| 333 |
+
h1 {
|
| 334 |
+
margin-bottom: 1rem;
|
| 335 |
+
}
|
| 336 |
+
.time-value {
|
| 337 |
+
height: 60%;
|
| 338 |
+
}
|
| 339 |
+
.time-label {
|
| 340 |
+
padding-top: 0.5rem;
|
| 341 |
+
}
|
| 342 |
+
}
|
| 343 |
+
|
| 344 |
+
@media (orientation: landscape) and (max-height: 500px) {
|
| 345 |
+
.timer-container {
|
| 346 |
+
padding: 0.5rem;
|
| 347 |
+
max-width: 90%;
|
| 348 |
+
}
|
| 349 |
+
h1 {
|
| 350 |
+
margin-bottom: 0.5rem;
|
| 351 |
+
font-size: 1.5rem;
|
| 352 |
+
}
|
| 353 |
+
.timer {
|
| 354 |
+
margin-bottom: 0.5rem;
|
| 355 |
+
}
|
| 356 |
+
.controls {
|
| 357 |
+
margin-top: 0.5rem;
|
| 358 |
+
}
|
| 359 |
+
.set-timer {
|
| 360 |
+
margin-top: 0.5rem;
|
| 361 |
+
}
|
| 362 |
}
|
| 363 |
</style>
|
| 364 |
</head>
|
|
|
|
| 397 |
<div class="time-input">
|
| 398 |
<input type="number" id="inputHours" min="0" max="99" value="0">
|
| 399 |
<div class="arrows">
|
| 400 |
+
<button class="arrow-btn" onclick="incrementHours()"></button>
|
| 401 |
<button class="arrow-btn down" onclick="decrementHours()"></button>
|
| 402 |
</div>
|
| 403 |
</div>
|
|
|
|
| 407 |
<div class="time-input">
|
| 408 |
<input type="number" id="inputMinutes" min="0" max="59" value="10">
|
| 409 |
<div class="arrows">
|
| 410 |
+
<button class="arrow-btn" onclick="incrementMinutes()"></button>
|
| 411 |
<button class="arrow-btn down" onclick="decrementMinutes()"></button>
|
| 412 |
</div>
|
| 413 |
</div>
|
|
|
|
| 417 |
<div class="time-input">
|
| 418 |
<input type="number" id="inputSeconds" min="0" max="59" value="0">
|
| 419 |
<div class="arrows">
|
| 420 |
+
<button class="arrow-btn" onclick="incrementSeconds()"></button>
|
| 421 |
<button class="arrow-btn down" onclick="decrementSeconds()"></button>
|
| 422 |
</div>
|
| 423 |
</div>
|
|
|
|
| 433 |
</div>
|
| 434 |
<h2>Time's Up!</h2>
|
| 435 |
<p>Your countdown has reached zero.</p>
|
| 436 |
+
<button id="newTimerBtn"><i class="fas fa-plus"></i> New Timer</button>
|
| 437 |
</div>
|
| 438 |
</div>
|
| 439 |
|
|
|
|
| 462 |
|
| 463 |
// Create particles
|
| 464 |
function createParticles() {
|
| 465 |
+
for (let i = 0; i < 30; i++) {
|
| 466 |
const particle = document.createElement('div');
|
| 467 |
particle.className = 'confetti';
|
| 468 |
particle.style.left = `${Math.random() * 100}vw`;
|
| 469 |
particle.style.top = `${Math.random() * 100}vh`;
|
| 470 |
+
particle.style.width = `${5 + Math.random() * 8}px`;
|
| 471 |
particle.style.height = particle.style.width;
|
| 472 |
particle.style.backgroundColor = `hsl(${Math.random() * 360}, 100%, 50%)`;
|
| 473 |
particles.appendChild(particle);
|
|
|
|
| 490 |
hoursElement.textContent = hours.toString().padStart(2, '0');
|
| 491 |
hoursElement.classList.remove('flip');
|
| 492 |
}, 300);
|
|
|
|
|
|
|
| 493 |
}
|
| 494 |
|
| 495 |
if (minutesElement.textContent !== minutes.toString().padStart(2, '0')) {
|
|
|
|
| 498 |
minutesElement.textContent = minutes.toString().padStart(2, '0');
|
| 499 |
minutesElement.classList.remove('flip');
|
| 500 |
}, 300);
|
|
|
|
|
|
|
| 501 |
}
|
| 502 |
|
| 503 |
if (secondsElement.textContent !== secs.toString().padStart(2, '0')) {
|
|
|
|
| 506 |
secondsElement.textContent = secs.toString().padStart(2, '0');
|
| 507 |
secondsElement.classList.remove('flip');
|
| 508 |
}, 300);
|
|
|
|
|
|
|
| 509 |
}
|
| 510 |
|
| 511 |
// Update progress bar
|
|
|
|
| 531 |
const seconds = parseInt(inputSeconds.value) || 0;
|
| 532 |
|
| 533 |
if (hours === 0 && minutes === 0 && seconds === 0) {
|
| 534 |
+
alert('Please set a valid time before starting.');
|
| 535 |
return;
|
| 536 |
}
|
| 537 |
|
|
|
|
| 541 |
isRunning = true;
|
| 542 |
updateDisplay(remainingSeconds);
|
| 543 |
|
| 544 |
+
countdownInterval = setInterval(() => {
|
| 545 |
remainingSeconds--;
|
| 546 |
|
| 547 |
if (remainingSeconds < 0) {
|
|
|
|
| 585 |
// Close modal
|
| 586 |
function closeModalFunc() {
|
| 587 |
modal.style.display = 'none';
|
| 588 |
+
// Reset confetti positions
|
| 589 |
+
document.querySelectorAll('.confetti').forEach(el => {
|
| 590 |
+
el.style.transform = 'translate(0, 0) rotate(0deg)';
|
| 591 |
+
el.style.opacity = '0';
|
| 592 |
+
});
|
| 593 |
}
|
| 594 |
|
| 595 |
// Start new timer
|
|
|
|
| 607 |
confettiElements.forEach((el, index) => {
|
| 608 |
setTimeout(() => {
|
| 609 |
el.style.opacity = '1';
|
| 610 |
+
el.style.transform = `translate(${(Math.random() - 0.5) * 100}px, ${(Math.random() - 0.5) * 100}px) rotate(${Math.random() * 360}deg)`;
|
| 611 |
el.style.transition = 'all 1s ease';
|
| 612 |
|
| 613 |
setTimeout(() => {
|
| 614 |
el.style.opacity = '0';
|
|
|
|
|
|
|
| 615 |
}, 1000);
|
| 616 |
}, index * 50);
|
| 617 |
});
|
|
|
|
| 652 |
else inputSeconds.value = 59;
|
| 653 |
}
|
| 654 |
|
| 655 |
+
// Handle keyboard input
|
| 656 |
+
function handleInputKeyPress(e) {
|
| 657 |
+
if (e.key === 'ArrowUp') {
|
| 658 |
+
e.preventDefault();
|
| 659 |
+
if (e.target.id === 'inputHours') incrementHours();
|
| 660 |
+
if (e.target.id === 'inputMinutes') incrementMinutes();
|
| 661 |
+
if (e.target.id === 'inputSeconds') incrementSeconds();
|
| 662 |
+
}
|
| 663 |
+
if (e.key === 'ArrowDown') {
|
| 664 |
+
e.preventDefault();
|
| 665 |
+
if (e.target.id === 'inputHours') decrementHours();
|
| 666 |
+
if (e.target.id === 'inputMinutes') decrementMinutes();
|
| 667 |
+
if (e.target.id === 'inputSeconds') decrementSeconds();
|
| 668 |
+
}
|
| 669 |
+
}
|
| 670 |
+
|
| 671 |
// Event listeners
|
| 672 |
startBtn.addEventListener('click', startCountdown);
|
| 673 |
pauseBtn.addEventListener('click', pauseCountdown);
|
| 674 |
resetBtn.addEventListener('click', resetCountdown);
|
| 675 |
closeModal.addEventListener('click', closeModalFunc);
|
| 676 |
newTimerBtn.addEventListener('click', startNewTimer);
|
| 677 |
+
inputHours.addEventListener('keydown', handleInputKeyPress);
|
| 678 |
+
inputMinutes.addEventListener('keydown', handleInputKeyPress);
|
| 679 |
+
inputSeconds.addEventListener('keydown', handleInputKeyPress);
|
| 680 |
|
| 681 |
// Initialize with default time
|
| 682 |
resetCountdown();
|
| 683 |
</script>
|
| 684 |
+
</body>
|
| 685 |
</html>
|