-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
98 lines (89 loc) · 2.45 KB
/
index.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>我嫩爹你知道吗</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #f0f0f0;
overflow: hidden;
}
canvas {
display: block;
position: fixed;
top: 0;
left: 0;
pointer-events: none;
}
.container {
width: 100%;
height: 100vh;
background-image: url('https://via.placeholder.com/1920x1080');
background-size: cover;
background-position: center;
position: relative;
overflow: hidden;
}
.content {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
text-align: center;
color: #fff;
z-index: 1;
}
</style>
</head>
<body>
<canvas id="canvas"></canvas>
<div class="container">
<div class="content">
<h1>我嫩爹你知道吗</h1>
<p>你知道</p>
</div>
</div>
<script>
const canvas = document.getElementById('canvas');
const ctx = canvas.getContext('2d');
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
const particles = [];
const colors = ['#f8f8ff', '#fffafa', '#fff8dc', '#fff5ee', '#f0f8ff'];
function createParticle() {
const x = Math.random() * canvas.width;
const y = -5;
const radius = Math.random() * 5 + 2;
const color = colors[Math.floor(Math.random() * colors.length)];
particles.push({ x, y, radius, color, speed: Math.random() * 3 + 1 });
}
function drawParticles() {
ctx.clearRect(0, 0, canvas.width, canvas.height);
particles.forEach((particle, index) => {
ctx.beginPath();
ctx.arc(particle.x, particle.y, particle.radius, 0, Math.PI * 2);
ctx.fillStyle = particle.color;
ctx.fill();
particle.y += particle.speed;
if (particle.y > canvas.height + particle.radius) {
particles.splice(index, 1);
}
});
}
function animate() {
createParticle();
drawParticles();
requestAnimationFrame(animate);
}
animate();
window.addEventListener('resize', () => {
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
});
</script>
</body>
</html>