-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patha.html
More file actions
550 lines (493 loc) · 17.3 KB
/
Copy patha.html
File metadata and controls
550 lines (493 loc) · 17.3 KB
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
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>uandm · 开屏</title>
<style>
/* ===== 极简重置 ===== */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
overflow: hidden;
background: #0a0618;
font-family: 'Arial Black', 'Helvetica Neue', sans-serif;
display: flex;
justify-content: center;
align-items: center;
user-select: none;
}
/* ===== 画布 (粒子) ===== */
#particleCanvas {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 0;
pointer-events: none;
}
/* ===== 主容器 ===== */
.hero {
position: relative;
z-index: 1;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
width: 100%;
height: 100%;
padding: 20px;
}
/* ===== 字母行 ===== */
.letters {
display: flex;
align-items: center;
justify-content: center;
gap: clamp(4px, 2vw, 20px);
flex-wrap: nowrap;
perspective: 600px;
}
/* ===== 字母容器 ===== */
.letter-wrapper {
display: inline-block;
opacity: 0;
transform: translateY(60px) scale(0.7);
animation: letterIn 0.9s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
animation-delay: calc(var(--i, 0) * 0.15s + 0.2s);
}
/* ===== 字母 ===== */
.letter {
font-size: clamp(3.6rem, 16vw, 10rem);
font-weight: 900;
letter-spacing: 0.02em;
display: inline-block;
text-shadow: 0 0 12px var(--glow-color, #fff);
animation: floatLetter 3s ease-in-out infinite;
animation-delay: calc(var(--i, 0) * 0.2s + 0.6s);
color: var(--letter-color, #fff);
}
/* 字母颜色 (保留) */
.letter-u {
--letter-color: #4dc9f6;
--glow-color: #4dc9f6;
}
.letter-a {
--letter-color: #f67280;
--glow-color: #f67280;
}
.letter-n {
--letter-color: #f9d976;
--glow-color: #f9d976;
}
.letter-d {
--letter-color: #6bcb77;
--glow-color: #6bcb77;
}
.letter-m {
--letter-color: #d16bff;
--glow-color: #d16bff;
}
/* ===== 入场 ===== */
@keyframes letterIn {
0% {
opacity: 0;
transform: translateY(60px) scale(0.7);
}
100% {
opacity: 1;
transform: translateY(0) scale(1);
}
}
/* ===== 浮动 ===== */
@keyframes floatLetter {
0%,
100% {
transform: translateY(0);
}
50% {
transform: translateY(-8px);
}
}
/* ===== 连接线 (简化: 无模糊) ===== */
.connector {
display: inline-block;
width: clamp(10px, 3vw, 30px);
height: 2px;
background: linear-gradient(90deg,
var(--c1, #4dc9f6),
var(--c2, #f67280));
border-radius: 2px;
opacity: 0;
animation: connectIn 0.6s ease-out forwards;
animation-delay: calc(var(--i, 0) * 0.15s + 1.0s);
}
.connector-1 {
--c1: #4dc9f6;
--c2: #f67280;
}
.connector-2 {
--c1: #f67280;
--c2: #f9d976;
}
.connector-3 {
--c1: #f9d976;
--c2: #6bcb77;
}
.connector-4 {
--c1: #6bcb77;
--c2: #d16bff;
}
@keyframes connectIn {
0% {
opacity: 0;
transform: scaleX(0);
}
100% {
opacity: 1;
transform: scaleX(1);
}
}
/* ===== 副标题 ===== */
.subtitle {
margin-top: clamp(16px, 4vh, 50px);
font-size: clamp(0.8rem, 2vw, 1.8rem);
font-weight: 300;
letter-spacing: 0.35em;
color: rgba(255, 255, 255, 0.45);
text-transform: uppercase;
opacity: 0;
animation: fadeUp 0.9s ease-out forwards;
animation-delay: 2.0s;
font-family: 'Helvetica Neue', Arial, sans-serif;
}
.subtitle span {
background: linear-gradient(90deg, #4dc9f6, #d16bff);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
font-weight: 600;
}
@keyframes fadeUp {
0% {
opacity: 0;
transform: translateY(16px);
}
100% {
opacity: 1;
transform: translateY(0);
}
}
/* ===== 背景光晕 (简化) ===== */
.hero::before {
content: '';
position: absolute;
top: 50%;
left: 50%;
width: 70vmax;
height: 70vmax;
transform: translate(-50%, -50%);
background: radial-gradient(circle at center,
rgba(77, 201, 246, 0.06) 0%,
rgba(209, 107, 255, 0.04) 40%,
transparent 75%);
border-radius: 50%;
z-index: -1;
animation: pulseBg 8s ease-in-out infinite alternate;
pointer-events: none;
}
@keyframes pulseBg {
0% {
transform: translate(-50%, -50%) scale(1);
opacity: 0.5;
}
100% {
transform: translate(-50%, -50%) scale(1.3);
opacity: 0.9;
}
}
/* ===== 响应式 ===== */
@media (max-width: 600px) {
.letters {
gap: 2px;
}
.connector {
width: 6px;
height: 1.5px;
}
.letter {
font-size: clamp(2.6rem, 12vw, 4.2rem);
}
}
@media (max-width: 400px) {
.letters {
gap: 0;
}
.connector {
width: 4px;
}
.letter {
font-size: clamp(2rem, 10vw, 3rem);
}
}
@media (orientation: landscape) and (max-height: 500px) {
.letter {
font-size: clamp(2.2rem, 10vh, 6rem);
}
.subtitle {
margin-top: 8px;
font-size: clamp(0.6rem, 1.8vh, 1.2rem);
}
.connector {
width: clamp(6px, 2.5vw, 20px);
}
}
</style>
</head>
<body>
<!-- 粒子 Canvas -->
<canvas id="particleCanvas"></canvas>
<!-- 主内容 -->
<div class="hero">
<div class="letters">
<span class="letter-wrapper" style="--i:0;">
<span class="letter letter-u">u</span>
</span>
<span class="connector connector-1" style="--i:0;"></span>
<span class="letter-wrapper" style="--i:1;">
<span class="letter letter-a">a</span>
</span>
<span class="connector connector-2" style="--i:1;"></span>
<span class="letter-wrapper" style="--i:2;">
<span class="letter letter-n">n</span>
</span>
<span class="connector connector-3" style="--i:2;"></span>
<span class="letter-wrapper" style="--i:3;">
<span class="letter letter-d">d</span>
</span>
<span class="connector connector-4" style="--i:3;"></span>
<span class="letter-wrapper" style="--i:4;">
<span class="letter letter-m">m</span>
</span>
</div>
<div class="subtitle">
<span>you & me</span> · 此刻相遇
</div>
</div>
<script>
// ============================================================
// 轻量粒子系统 —— 大幅简化,降低 CPU 负载
// ============================================================
const canvas = document.getElementById('particleCanvas');
const ctx = canvas.getContext('2d');
let W, H;
let particles = [];
const MAX_PARTICLES = 100; // 从 280 → 100
let frameCount = 0;
// ---------- 获取字母位置 ----------
function getLetterPositions() {
const wrappers = document.querySelectorAll('.letter-wrapper');
const positions = [];
wrappers.forEach((wrapper) => {
const rect = wrapper.getBoundingClientRect();
const cx = rect.left + rect.width / 2;
const cy = rect.top + rect.height / 2;
const letterEl = wrapper.querySelector('.letter');
let color = '#4dc9f6';
if (letterEl) {
const computed = getComputedStyle(letterEl);
color = computed.getPropertyValue('--letter-color').trim() || '#4dc9f6';
}
positions.push({ x: cx, y: cy, color });
});
return positions;
}
// ---------- 粒子类 (无拖尾,无阴影,极简) ----------
class Particle {
constructor(x, y, color) {
this.x = x;
this.y = y;
const angle = Math.random() * Math.PI * 2;
const speed = 0.6 + Math.random() * 1.8;
this.vx = Math.cos(angle) * speed;
this.vy = Math.sin(angle) * speed - 0.4;
this.size = 1.5 + Math.random() * 3.5;
this.life = 1;
this.decay = 0.008 + Math.random() * 0.018;
this.color = color;
this.alpha = 0.8 + Math.random() * 0.2;
}
update() {
this.vx *= 0.995;
this.vy += 0.03;
this.x += this.vx;
this.y += this.vy;
this.life -= this.decay;
this.alpha = this.life * 0.8 + 0.2;
this.size *= 0.998;
}
draw(ctx) {
if (this.life <= 0 || this.size < 0.3) return;
const a = Math.min(this.alpha, 1);
ctx.globalAlpha = a;
ctx.beginPath();
ctx.arc(this.x, this.y, this.size, 0, Math.PI * 2);
ctx.fillStyle = this.color;
ctx.fill();
ctx.globalAlpha = 1;
}
isDead() {
return this.life <= 0 || this.size < 0.3 ||
this.y > H + 30 || this.x < -30 || this.x > W + 30;
}
}
// ---------- Canvas 尺寸 ----------
function resizeCanvas() {
W = window.innerWidth;
H = window.innerHeight;
canvas.width = W;
canvas.height = H;
}
// ---------- 发射粒子 ----------
function emitParticles(count) {
const positions = getLetterPositions();
if (positions.length === 0) return;
for (let i = 0; i < count; i++) {
const pos = positions[Math.floor(Math.random() * positions.length)];
const p = new Particle(
pos.x + (Math.random() - 0.5) * 24,
pos.y + (Math.random() - 0.5) * 24,
pos.color
);
const angle = Math.random() * Math.PI * 2;
const speed = 0.4 + Math.random() * 2.0;
p.vx = Math.cos(angle) * speed;
p.vy = Math.sin(angle) * speed - 0.5;
p.size = 1.2 + Math.random() * 3.2;
particles.push(p);
}
if (particles.length > MAX_PARTICLES * 1.6) {
particles = particles.slice(-MAX_PARTICLES);
}
}
// ---------- 清理 ----------
function cleanParticles() {
particles = particles.filter(p => !p.isDead());
if (particles.length > MAX_PARTICLES) {
particles = particles.slice(0, MAX_PARTICLES);
}
}
// ---------- 背景星星 (极少) ----------
let stars = [];
function initStars() {
const count = 35; // 从 60 → 35
for (let i = 0; i < count; i++) {
stars.push({
x: Math.random() * W,
y: Math.random() * H,
size: 0.4 + Math.random() * 1.2,
speed: 0.004 + Math.random() * 0.012,
phase: Math.random() * Math.PI * 2,
alpha: 0.15 + Math.random() * 0.35,
});
}
}
function drawStars() {
const time = Date.now() * 0.001;
for (const s of stars) {
const flicker = 0.5 + 0.5 * Math.sin(time * s.speed * 2 + s.phase);
const alpha = s.alpha * flicker * 0.6;
ctx.globalAlpha = alpha;
ctx.beginPath();
ctx.arc(s.x, s.y, s.size * (0.6 + 0.4 * flicker), 0, Math.PI * 2);
ctx.fillStyle = '#fff';
ctx.fill();
}
ctx.globalAlpha = 1;
}
// ---------- 主动画循环 ----------
function animate() {
frameCount++;
// 每 2 帧发射一次,减少计算
if (frameCount % 2 === 0 && particles.length < MAX_PARTICLES) {
if (Math.random() < 0.25) {
emitParticles(1 + (Math.random() < 0.3 ? 1 : 0));
}
}
for (const p of particles) {
p.update();
}
cleanParticles();
ctx.clearRect(0, 0, W, H);
// 画星星
drawStars();
// 画粒子
for (const p of particles) {
p.draw(ctx);
}
requestAnimationFrame(animate);
}
// ---------- 窗口变化 ----------
window.addEventListener('resize', () => {
resizeCanvas();
stars = [];
initStars();
});
// ---------- 点击 / 触摸 爆发 (保留但减少数量) ----------
function burstParticles(x, y) {
const count = 6 + Math.floor(Math.random() * 10); // 从 12-16 → 6-10
const colors = ['#4dc9f6', '#f67280', '#f9d976', '#6bcb77', '#d16bff'];
for (let i = 0; i < count; i++) {
const p = new Particle(
x + (Math.random() - 0.5) * 40,
y + (Math.random() - 0.5) * 40,
colors[Math.floor(Math.random() * colors.length)]
);
const angle = Math.random() * Math.PI * 2;
const speed = 0.8 + Math.random() * 3;
p.vx = Math.cos(angle) * speed;
p.vy = Math.sin(angle) * speed - 0.8;
p.size = 1.5 + Math.random() * 4;
p.decay = 0.01 + Math.random() * 0.015;
particles.push(p);
}
if (particles.length > MAX_PARTICLES * 1.6) {
particles = particles.slice(-MAX_PARTICLES);
}
}
document.addEventListener('click', (e) => {
burstParticles(e.clientX, e.clientY);
});
document.addEventListener('touchstart', (e) => {
const touch = e.touches[0];
if (touch) {
burstParticles(touch.clientX, touch.clientY);
}
}, { passive: true });
// ---------- 启动 ----------
function init() {
resizeCanvas();
initStars();
// 初始粒子
for (let i = 0; i < 30; i++) {
setTimeout(() => {
emitParticles(1 + Math.floor(Math.random() * 2));
}, i * 20);
}
animate();
}
if (document.readyState === 'complete') {
init();
} else {
window.addEventListener('load', init);
}
console.log('✨ uandm · 轻量开屏已加载 (CPU 优化版)');
</script>
</body>
</html>