File size: 9,464 Bytes
52636af 809ce36 52636af |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 |
<!DOCTYPE html>
<html lang="zh">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>春节拜年 - LINUX DO</title>
<script src="https://cdn.tailwindcss.com"></script>
<style>
body {
margin: 0;
padding: 0;
overflow: hidden;
background-color: #ff4d4d; /* 红色背景 */
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
position: relative;
}
canvas {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
pointer-events: none;
z-index: 0; /* 确保烟花在最底层 */
}
.red-envelope {
width: 200px;
height: 300px;
background-color: #d9534f;
border-radius: 15px;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
overflow: hidden;
z-index: 2;
}
.red-envelope .top {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 0;
background-color: #a92b29;
animation: openTop 2s ease-out forwards;
z-index: 1;
}
.red-envelope .top-text {
position: absolute;
top: 15%;
left: 50%;
transform: translateX(-50%);
font-size: 16px;
color: #fff;
font-weight: bold;
opacity: 0;
animation: showText 2s 1.5s forwards;
text-align: center;
}
.red-envelope .content {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
color: #fff;
font-size: 24px;
font-weight: bold;
z-index: 0;
opacity: 0;
animation: showContent 2s 1.5s forwards;
}
@keyframes openTop {
0% {
height: 0;
}
100% {
height: 33%;
}
}
@keyframes showText {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
@keyframes showContent {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
.countdown {
position: absolute;
top: 10px;
left: 10px;
padding: 10px;
background-color: rgba(0, 0, 0, 0.5);
border-radius: 10px;
color: white;
font-size: 18px;
font-weight: bold;
backdrop-filter: blur(5px);
z-index: 4;
}
.logo-container {
position: absolute;
bottom: 5%;
text-align: center;
z-index: 3;
left: 50%;
transform: translateX(-50%);
}
.logo-container img {
width: 150px;
height: auto;
margin-bottom: 20px;
}
.logo-container .text {
font-size: 24px;
color: white;
font-weight: bold;
}
.emoji {
position: absolute;
font-size: 2rem;
pointer-events: none;
animation: floatUp 2s ease-out forwards;
}
@keyframes floatUp {
0% {
opacity: 1;
transform: translateY(0);
}
100% {
opacity: 0;
transform: translateY(-100px);
}
}
.spark {
width: 5px;
height: 5px;
border-radius: 50%;
position: absolute;
animation: explode 1s ease-out forwards;
}
@keyframes explode {
0% {
opacity: 1;
transform: translate(0, 0);
}
100% {
opacity: 0;
transform: translate(var(--dx), var(--dy));
}
}
</style>
</head>
<body>
<canvas id="fireworksCanvas"></canvas>
<div class="red-envelope">
<div class="top"></div>
<div class="top-text">富强民主文明和谐</div>
<div class="content">LINUX DO</div>
</div>
<div class="logo-container">
<img src="linux.do.png" alt="LINUX DO Logo">
<div class="text">LINUX DO</div>
</div>
<div class="countdown" id="countdown"></div>
<div id="fireworks-container" class="fixed top-0 left-0 w-full h-full pointer-events-none"></div>
<script>
// 获取 canvas 元素
const canvas = document.getElementById('fireworksCanvas');
const ctx = canvas.getContext('2d');
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
// 烟花效果
class Firework {
constructor(x, y) {
this.x = x;
this.y = y;
this.alpha = 1;
this.particles = [];
this.createParticles();
}
createParticles() {
const colors = ['#ffdf00', '#ff6347', '#32cd32', '#ff4500', '#00bfff', '#ff1493'];
for (let i = 0; i < 500; i++) {
this.particles.push(new Particle(this.x, this.y, colors[Math.floor(Math.random() * colors.length)]));
}
}
update() {
this.particles.forEach(particle => particle.update());
this.alpha -= 0.02;
}
draw() {
this.particles.forEach(particle => particle.draw());
}
isDead() {
return this.alpha <= 0;
}
}
class Particle {
constructor(x, y, color) {
this.x = x;
this.y = y;
this.color = color;
this.size = Math.random() * 6 + 3;
this.speedX = Math.random() * 12 - 6;
this.speedY = Math.random() * 12 - 6;
this.alpha = 1;
this.lifeTime = Math.random() * 2 + 1;
}
update() {
this.x += this.speedX;
this.y += this.speedY;
this.alpha -= 0.02;
this.size *= 0.98;
this.lifeTime -= 0.02;
}
draw() {
ctx.beginPath();
ctx.arc(this.x, this.y, this.size, 0, Math.PI * 2);
ctx.fillStyle = this.color;
ctx.globalAlpha = this.alpha;
ctx.fill();
}
}
const fireworks = [];
function createFirework(x, y) {
fireworks.push(new Firework(x, y));
}
function animate() {
ctx.clearRect(0, 0, canvas.width, canvas.height);
fireworks.forEach((firework, index) => {
firework.update();
firework.draw();
if (firework.isDead()) {
fireworks.splice(index, 1);
}
});
requestAnimationFrame(animate);
}
setInterval(() => {
const randomX = Math.random() * canvas.width;
const randomY = Math.random() * canvas.height;
createFirework(randomX, randomY);
}, Math.random() * 300 + 200);
animate();
// 随机 emoji 列表
const emojis = ['🎉', '✨', '🎆', '🎇', '💥', '❤️', '🌟', '😊', '🥳', '🎊', '🎈', '🌸', '🌠', '🌈', '🔥'];
// 生成随机 emoji
function getRandomEmoji() {
return emojis[Math.floor(Math.random() * emojis.length)];
}
// 创建 emoji
function createEmoji(x, y) {
const emoji = document.createElement('div');
emoji.classList.add('emoji');
emoji.textContent = getRandomEmoji();
emoji.style.left = `${x}px`;
emoji.style.top = `${y}px`;
document.body.appendChild(emoji);
// 移除 emoji 元素
setTimeout(() => {
document.body.removeChild(emoji);
}, 2000);
}
// 用户按下任意键或点击鼠标发射随机 emoji
document.addEventListener('keydown', (event) => {
const x = Math.random() * window.innerWidth;
const y = Math.random() * window.innerHeight;
createEmoji(x, y);
});
document.addEventListener('click', (event) => {
createEmoji(event.clientX, event.clientY);
createFirework(event.clientX, event.clientY);
});
// 获取农历春节日期
function getChineseNewYearDate() {
return new Date('2025-01-29T00:00:00');
}
// 更新倒计时
function updateCountdown() {
const now = new Date();
const newYearDate = getChineseNewYearDate();
const timeDiff = newYearDate - now;
if (timeDiff > 0) {
const days = Math.floor(timeDiff / (1000 * 60 * 60 * 24));
const hours = Math.floor((timeDiff % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
const minutes = Math.floor((timeDiff % (1000 * 60 * 60)) / (1000 * 60));
const seconds = Math.floor((timeDiff % (1000 * 60)) / 1000);
document.getElementById('countdown').textContent = `距离新年还有 ${days}天 ${hours}时 ${minutes}分 ${seconds}秒`;
} else {
const daysSince = Math.floor(-timeDiff / (1000 * 60 * 60 * 24));
const hoursSince = Math.floor((-timeDiff % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
const minutesSince = Math.floor((-timeDiff % (1000 * 60 * 60)) / (1000 * 60));
const secondsSince = Math.floor((-timeDiff % (1000 * 60)) / 1000);
document.getElementById('countdown').textContent = `新的一年已经开始了 ${daysSince}天 ${hoursSince}时 ${minutesSince}分 ${secondsSince}秒`;
}
}
setInterval(updateCountdown, 1000);
updateCountdown();
</script>
</body>
</html> |