-
Notifications
You must be signed in to change notification settings - Fork 0
/
ny.html
453 lines (389 loc) · 14 KB
/
ny.html
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
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
<!DOCTYPE html>
<html>
<head>
<title>元旦特别版点名器</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" href="favicon.png">
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;700&display=swap" rel="stylesheet">
<style>
body,
html {
height: 100%;
margin: 0;
overflow: hidden;
background: linear-gradient(45deg,
#c72c41, /* 大红色 */
#9e1a24, /* 朱砂红 */
#b2292e, /* 枣红 */
#ff4d4f, /* 年画红 */
#a22041 /* 紫红 */
);
background-size: 400% 400%;
animation: gradientBG 15s ease infinite;
font-family: 'Noto Sans SC', sans-serif;
}
/* 添加渐变动画 */
@keyframes gradientBG {
0% {
background-position: 0% 50%;
}
50% {
background-position: 100% 50%;
}
100% {
background-position: 0% 50%;
}
}
/* 添加星光效果 */
.stars {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
pointer-events: none;
background: transparent;
}
.star {
position: absolute;
width: 2px;
height: 2px;
background: #fff;
border-radius: 50%;
opacity: 0;
animation: twinkle 1s infinite;
}
@keyframes twinkle {
0%,
100% {
opacity: 0;
}
50% {
opacity: 1;
}
}
/* 添加模糊光晕效果 */
.container::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: radial-gradient(circle at center,
rgba(255, 255, 255, 0.1) 0%,
rgba(255, 255, 255, 0) 70%);
pointer-events: none;
}
.container {
position: relative;
text-align: center;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
height: 100vh;
z-index: 1;
}
@keyframes ascend {
0% {
transform: translateY(100vh);
opacity: 1;
}
100% {
transform: translateY(20vh);
opacity: 1;
}
}
.firework {
position: absolute;
width: 10px;
height: 10px;
border-radius: 50%;
}
.ascending {
animation: ascend 1.5s ease-out forwards;
}
.spark {
position: absolute;
width: 5px;
height: 5px;
animation: spark 1.5s ease-out forwards;
border-radius: 50%;
}
@keyframes spark {
0% {
transform: translate(0, 0) scale(1);
opacity: 1;
}
100% {
transform: translate(var(--tx), var(--ty)) scale(0);
opacity: 0;
}
}
@keyframes snowfall {
0% {
transform: translateY(-10vh) translateX(0);
opacity: 1;
}
100% {
transform: translateY(100vh) translateX(100px);
opacity: 0;
}
}
.snowflake {
color: #fff;
font-size: 2em;
font-family: Arial;
text-shadow: 0 0 5px #000;
position: fixed;
top: -50px;
}
@keyframes slide {
from {
background-position: 0 0;
}
to {
background-position: -100% 0;
}
}
@keyframes swing {
0%,
100% {
transform: rotate(-5deg);
}
50% {
transform: rotate(5deg);
}
}
h1 {
color: #FFD700;
font-weight: bold;
font-size: 48px;
text-shadow: 0 0 10px rgba(255, 215, 0, 0.5),
0 0 20px rgba(255, 215, 0, 0.3),
0 0 30px rgba(255, 215, 0, 0.2);
margin-bottom: 40px;
background: linear-gradient(45deg, #FFD700, #FFA500);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
position: relative;
}
#nameDisplay {
font-size: 60px;
margin: 30px;
color: #fff;
text-shadow: 0 0 20px rgba(255, 255, 255, 0.8);
background: rgba(255, 255, 255, 0.15);
padding: 30px 60px;
border-radius: 20px;
backdrop-filter: blur(10px);
min-width: 300px;
min-height: 100px;
display: flex;
align-items: center;
justify-content: center;
border: 2px solid rgba(255, 215, 0, 0.3);
transition: all 0.3s ease;
}
#nameDisplay.highlight {
transform: scale(1.1);
background: rgba(255, 215, 0, 0.2);
border-color: rgba(255, 215, 0, 0.8);
}
#startButton {
background: linear-gradient(45deg, #FFD700, #FF4500);
box-shadow: 0 0 20px rgba(255, 69, 0, 0.4),
inset 0 0 15px rgba(255, 255, 255, 0.3);
border: 2px solid rgba(255, 215, 0, 0.5);
text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
color: #fff;
padding: 15px 50px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 24px;
margin-top: 30px;
transition: all 0.3s ease-in-out;
border-radius: 50px;
cursor: pointer;
font-weight: bold;
position: relative;
overflow: hidden;
}
#startButton:hover {
transform: scale(1.05);
box-shadow: 0 0 30px rgba(255, 69, 0, 0.6);
}
#startButton:active {
transform: scale(0.95);
}
#startButton.disabled {
background: #666;
cursor: not-allowed;
box-shadow: none;
}
.title-decoration {
font-size: 24px;
color: #FFD700;
margin: 0 10px;
display: inline-block;
animation: sparkle 1.5s ease-in-out infinite;
}
@keyframes sparkle {
0%,
100% {
transform: scale(1);
opacity: 1;
}
50% {
transform: scale(1.2);
opacity: 0.8;
}
}
.firework-container {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
pointer-events: none;
z-index: 0;
}
</style>
</head>
<body>
<div class="stars"></div>
<div class="container">
<h1><span class="title-decoration"></span>🎊点名器🎊<span class="title-decoration"></span></h1>
<div id="nameDisplay"></div>
<button id="startButton">开始点名</button>
</div>
<div class="firework-container"></div>
<script>
let currentInterval = null;
let currentTimeout = null;
function createSnowflakes() {
const snowflakes = ['❄', '❅', '❆', '❉', '❊'];
const container = document.querySelector('.container');
setInterval(() => {
const snowflake = document.createElement('div');
snowflake.className = 'snowflake';
snowflake.style.left = Math.random() * 100 + 'vw';
snowflake.style.animationDuration = Math.random() * 3 + 2 + 's';
snowflake.style.opacity = Math.random();
snowflake.innerHTML = snowflakes[Math.floor(Math.random() * snowflakes.length)];
snowflake.style.animation = 'snowfall linear';
snowflake.style.animationDuration = Math.random() * 3 + 2 + 's';
container.appendChild(snowflake);
setTimeout(() => {
snowflake.remove();
}, 5000);
}, 400);
}
const audio = new Audio('sound.mp3');
const allNames = [
"陈弈仁", "卿高翔", "朱子言", "万瑞辰", "刘宇", "付子灏", "陈思齐", "王周骏",
"贺昱玮", "张晏阳", "高博杨", "吕焌华", "潘高锐", "吴嘉镱", "张哲瑀",
"康陈琛", "汪轩羽", "钟心", "段景译", "陈思成", "沈乐", "李正灿", "武伯昂",
"樊尉然", "李梓贤", "万昱成", "李昀臻", "何厚辰", "易畅", "黄胤淇", "吴昊宸",
"胡恒搏", "尹致尧", "李叙徵", "王若锦", "徐德杉", "马昕玥", "孙婉宸", "周玥梦",
"杨莞儿", "方异霖", "茹奕", "苏禹蒙", "钱然", "赵梓越", "李李滟", "郭思宜",
"毛秋童", "李梓贝", "周瑾", "孔雯暄", "张语萱", "孟薇", "张程程", "肖雅月", "刘学万",
"班长", "劳动委员", "宣传委员", "文艺委员", "语文课代表", "数学课代表", "英语课代表", "物理课代表", "化学课代表", "生物课代表", "政治课代表", "信息课代表", "通用课代表", "体育委员", "学习委员"
];
function createSparks(x, fireworkContainer, topY) {
const colors = ['#ff0', '#f0f', '#0ff', '#ff4500', '#7fff00'];
const sparkCount = 50;
for (let i = 0; i < sparkCount; i++) {
const spark = document.createElement('div');
spark.className = 'spark';
spark.style.left = x + 'px';
spark.style.top = topY + 'px';
spark.style.backgroundColor = colors[Math.floor(Math.random() * colors.length)];
const angle = (i * 360 / sparkCount) * Math.PI / 180;
const velocity = 150 + Math.random() * 100;
spark.style.setProperty('--tx', Math.cos(angle) * velocity + 'px');
spark.style.setProperty('--ty', Math.sin(angle) * velocity + 'px');
fireworkContainer.appendChild(spark);
spark.addEventListener('animationend', () => {
spark.remove();
});
}
}
function createFirework() {
const colors = ['#ff0', '#f0f', '#0ff', '#ff4500', '#7fff00'];
const fireworkContainer = document.querySelector('.firework-container');
const x = Math.random() * window.innerWidth;
const firework = document.createElement('div');
firework.className = 'firework ascending';
firework.style.left = x + 'px';
firework.style.backgroundColor = colors[Math.floor(Math.random() * colors.length)];
fireworkContainer.appendChild(firework);
// 等火箭到达最高点后再绽放
firework.addEventListener('animationend', () => {
createSparks(x, fireworkContainer, window.innerHeight * 0.2);
firework.remove();
});
}
function startRolling() {
if (currentInterval) {
clearInterval(currentInterval);
currentInterval = null;
}
if (currentTimeout) {
clearTimeout(currentTimeout);
currentTimeout = null;
}
const nameDisplay = document.getElementById('nameDisplay');
const startButton = document.getElementById('startButton');
startButton.disabled = true;
startButton.classList.add('disabled');
nameDisplay.classList.remove('highlight');
audio.currentTime = 0;
audio.play();
console.log(`总人数:${allNames.length}人`);
let randomName;
currentInterval = setInterval(() => {
randomName = allNames[Math.floor(Math.random() * allNames.length)];
nameDisplay.textContent = randomName;
}, 40);
currentTimeout = setTimeout(() => {
clearInterval(currentInterval);
currentInterval = null;
audio.pause();
audio.currentTime = 0;
nameDisplay.textContent = randomName;
nameDisplay.classList.add('highlight');
startButton.disabled = false;
startButton.classList.remove('disabled');
console.log(`✨ 抽中:${randomName}`);
// 创建更多烟花
for (let i = 0; i < 8; i++) {
setTimeout(() => {
createFirework();
}, i * 500);
}
}, Math.random() * 800 + 800);
}
function createStars() {
const starsContainer = document.querySelector('.stars');
const starCount = 100;
for (let i = 0; i < starCount; i++) {
const star = document.createElement('div');
star.className = 'star';
star.style.left = `${Math.random() * 100}%`;
star.style.top = `${Math.random() * 100}%`;
star.style.animationDelay = `${Math.random() * 1}s`;
starsContainer.appendChild(star);
}
}
document.addEventListener('DOMContentLoaded', function () {
const startButton = document.getElementById('startButton');
startButton.addEventListener('click', startRolling);
createSnowflakes();
createStars();
});
</script>
</body>
</html>