327 lines
9.9 KiB
HTML
327 lines
9.9 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="zh-CN">
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
<title>保研倒计时</title>
|
||
<style>
|
||
* {
|
||
margin: 0;
|
||
padding: 0;
|
||
box-sizing: border-box;
|
||
}
|
||
|
||
body {
|
||
font-family: 'Microsoft YaHei', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
|
||
background: linear-gradient(135deg, #0ab026, #667eea, #f093fb, #4facfe, #43e97b, #fa709a, #0ab026);
|
||
background-size: 600% 600%;
|
||
animation: gradientShift 30s ease-in-out infinite;
|
||
min-height: 100vh;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
color: white;
|
||
overflow: hidden;
|
||
}
|
||
|
||
@keyframes gradientShift {
|
||
0% {
|
||
background-position: 0% 50%;
|
||
}
|
||
20% {
|
||
background-position: 50% 100%;
|
||
}
|
||
40% {
|
||
background-position: 100% 50%;
|
||
}
|
||
60% {
|
||
background-position: 50% 0%;
|
||
}
|
||
80% {
|
||
background-position: 100% 100%;
|
||
}
|
||
100% {
|
||
background-position: 0% 50%;
|
||
}
|
||
}
|
||
|
||
.countdown-container {
|
||
text-align: center;
|
||
background: rgba(255, 255, 255, 0.1);
|
||
backdrop-filter: blur(10px);
|
||
border-radius: 20px;
|
||
padding: 40px;
|
||
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
|
||
border: 1px solid rgba(255, 255, 255, 0.2);
|
||
max-width: 800px;
|
||
width: 90%;
|
||
}
|
||
|
||
.title {
|
||
font-size: 2.5rem;
|
||
margin-bottom: 40px;
|
||
font-weight: 300;
|
||
letter-spacing: 2px;
|
||
text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
|
||
}
|
||
|
||
.countdown-display {
|
||
display: flex;
|
||
justify-content: center;
|
||
gap: 30px;
|
||
margin: 40px 0;
|
||
flex-wrap: wrap;
|
||
}
|
||
|
||
.time-unit {
|
||
background: rgba(255, 255, 255, 0.15);
|
||
border-radius: 15px;
|
||
padding: 25px 20px;
|
||
min-width: 120px;
|
||
backdrop-filter: blur(5px);
|
||
border: 1px solid rgba(255, 255, 255, 0.2);
|
||
transition: transform 0.3s ease, box-shadow 0.3s ease;
|
||
}
|
||
|
||
.time-unit:hover {
|
||
transform: translateY(-5px);
|
||
box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2);
|
||
}
|
||
|
||
.time-value {
|
||
font-size: 3rem;
|
||
font-weight: bold;
|
||
display: block;
|
||
margin-bottom: 10px;
|
||
text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
|
||
color: #fff;
|
||
}
|
||
|
||
.time-label {
|
||
font-size: 1.1rem;
|
||
color: rgba(255, 255, 255, 0.9);
|
||
font-weight: 300;
|
||
letter-spacing: 1px;
|
||
}
|
||
|
||
.target-date {
|
||
font-size: 1.5rem;
|
||
margin-top: 30px;
|
||
color: rgba(255, 255, 255, 0.8);
|
||
font-weight: 300;
|
||
}
|
||
|
||
/* 背景动画 */
|
||
.background-animation {
|
||
position: fixed;
|
||
top: 0;
|
||
left: 0;
|
||
width: 100%;
|
||
height: 100%;
|
||
z-index: -1;
|
||
overflow: hidden;
|
||
}
|
||
|
||
.floating-element {
|
||
position: absolute;
|
||
border-radius: 50%;
|
||
background: rgba(255, 255, 255, 0.1);
|
||
animation: float 20s infinite linear;
|
||
}
|
||
|
||
@keyframes float {
|
||
0% {
|
||
transform: translateY(100vh) rotate(0deg);
|
||
}
|
||
100% {
|
||
transform: translateY(-100px) rotate(360deg);
|
||
}
|
||
}
|
||
|
||
/* 响应式设计 */
|
||
@media (max-width: 768px) {
|
||
.title {
|
||
font-size: 2rem;
|
||
}
|
||
|
||
.countdown-display {
|
||
gap: 20px;
|
||
}
|
||
|
||
.time-unit {
|
||
min-width: 100px;
|
||
padding: 20px 15px;
|
||
}
|
||
|
||
.time-value {
|
||
font-size: 2.5rem;
|
||
}
|
||
|
||
.time-label {
|
||
font-size: 1rem;
|
||
}
|
||
|
||
.countdown-container {
|
||
padding: 30px 20px;
|
||
}
|
||
}
|
||
|
||
@media (max-width: 480px) {
|
||
.title {
|
||
font-size: 1.5rem;
|
||
margin-bottom: 30px;
|
||
}
|
||
|
||
.countdown-display {
|
||
gap: 15px;
|
||
}
|
||
|
||
.time-unit {
|
||
min-width: 80px;
|
||
padding: 15px 10px;
|
||
}
|
||
|
||
.time-value {
|
||
font-size: 2rem;
|
||
}
|
||
|
||
.target-date {
|
||
font-size: 1.2rem;
|
||
}
|
||
}
|
||
|
||
/* 已到达目标时间的样式 */
|
||
.celebration {
|
||
animation: celebration 2s infinite;
|
||
}
|
||
|
||
@keyframes celebration {
|
||
0%, 100% { transform: scale(1); }
|
||
50% { transform: scale(1.05); }
|
||
}
|
||
</style>
|
||
</head>
|
||
<body>
|
||
<div class="background-animation" id="backgroundAnimation"></div>
|
||
|
||
<div class="countdown-container">
|
||
<h1 class="title">距离 2025年9月29日 还有</h1>
|
||
|
||
<div class="countdown-display" id="countdownDisplay">
|
||
<div class="time-unit">
|
||
<span class="time-value" id="days">00</span>
|
||
<span class="time-label">天</span>
|
||
</div>
|
||
<div class="time-unit">
|
||
<span class="time-value" id="hours">00</span>
|
||
<span class="time-label">小时</span>
|
||
</div>
|
||
<div class="time-unit">
|
||
<span class="time-value" id="minutes">00</span>
|
||
<span class="time-label">分钟</span>
|
||
</div>
|
||
<div class="time-unit">
|
||
<span class="time-value" id="seconds">00</span>
|
||
<span class="time-label">秒</span>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="target-date">下一站:上岸</div>
|
||
</div>
|
||
|
||
<script>
|
||
// 目标日期:2025年9月29日
|
||
const targetDate = new Date('2025-09-29T00:00:00').getTime();
|
||
|
||
// 创建背景动画元素
|
||
function createFloatingElements() {
|
||
const container = document.getElementById('backgroundAnimation');
|
||
const elementCount = 15;
|
||
|
||
for (let i = 0; i < elementCount; i++) {
|
||
const element = document.createElement('div');
|
||
element.className = 'floating-element';
|
||
|
||
// 随机大小和位置
|
||
const size = Math.random() * 60 + 20;
|
||
element.style.width = size + 'px';
|
||
element.style.height = size + 'px';
|
||
element.style.left = Math.random() * 100 + '%';
|
||
element.style.animationDelay = Math.random() * 20 + 's';
|
||
element.style.animationDuration = (Math.random() * 10 + 15) + 's';
|
||
|
||
container.appendChild(element);
|
||
}
|
||
}
|
||
|
||
// 更新倒计时显示
|
||
function updateCountdown() {
|
||
const now = new Date().getTime();
|
||
const distance = targetDate - now;
|
||
|
||
const daysElement = document.getElementById('days');
|
||
const hoursElement = document.getElementById('hours');
|
||
const minutesElement = document.getElementById('minutes');
|
||
const secondsElement = document.getElementById('seconds');
|
||
const titleElement = document.querySelector('.title');
|
||
const containerElement = document.querySelector('.countdown-container');
|
||
|
||
if (distance < 0) {
|
||
// 时间已到
|
||
titleElement.textContent = '🎉 时间已到!🎉';
|
||
daysElement.textContent = '00';
|
||
hoursElement.textContent = '00';
|
||
minutesElement.textContent = '00';
|
||
secondsElement.textContent = '00';
|
||
containerElement.classList.add('celebration');
|
||
return;
|
||
}
|
||
|
||
// 计算剩余时间
|
||
const days = Math.floor(distance / (1000 * 60 * 60 * 24));
|
||
const hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
|
||
const minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
|
||
const seconds = Math.floor((distance % (1000 * 60)) / 1000);
|
||
|
||
// 更新显示(添加前导零)
|
||
daysElement.textContent = days.toString().padStart(2, '0');
|
||
hoursElement.textContent = hours.toString().padStart(2, '0');
|
||
minutesElement.textContent = minutes.toString().padStart(2, '0');
|
||
secondsElement.textContent = seconds.toString().padStart(2, '0');
|
||
|
||
// 移除庆祝动画类(如果存在)
|
||
containerElement.classList.remove('celebration');
|
||
}
|
||
|
||
// 添加数字变化动画效果
|
||
function animateNumberChange(element, newValue) {
|
||
if (element.textContent !== newValue) {
|
||
element.style.transform = 'scale(1.1)';
|
||
element.style.transition = 'transform 0.1s ease';
|
||
|
||
setTimeout(() => {
|
||
element.textContent = newValue;
|
||
element.style.transform = 'scale(1)';
|
||
}, 50);
|
||
}
|
||
}
|
||
|
||
// 页面加载完成后初始化
|
||
document.addEventListener('DOMContentLoaded', function() {
|
||
createFloatingElements();
|
||
updateCountdown();
|
||
|
||
// 每秒更新一次倒计时
|
||
setInterval(updateCountdown, 1000);
|
||
});
|
||
|
||
// 页面可见性变化时重新计算(避免标签页不活跃时计时不准确)
|
||
document.addEventListener('visibilitychange', function() {
|
||
if (!document.hidden) {
|
||
updateCountdown();
|
||
}
|
||
});
|
||
</script>
|
||
</body>
|
||
</html>
|