-
Notifications
You must be signed in to change notification settings - Fork 0
/
01.up_to_the_sky.html
58 lines (55 loc) · 1.8 KB
/
01.up_to_the_sky.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Up to the sky</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.9.1/gsap.min.js"></script>
<style>
body, html {
margin: 0;
padding: 0;
overflow: hidden;
width: 100%;
height: 100%;
background-color: #000;
}
.particle {
position: absolute;
width: 5px;
height: 100%;
background-color: #00FFFF;
}
</style>
</head>
<body>
<script>
function createParticle() {
const particle = document.createElement('div');
particle.classList.add('particle');
particle.style.left = Math.random() * window.innerWidth + 'px';
particle.style.top = window.innerHeight + 'px';
document.body.appendChild(particle);
return particle;
}
function animateParticles() {
const particles = document.querySelectorAll('.particle');
gsap.to(particles, {
duration: 1,
y: "-100%", // Move particles up by 100% of the window height
ease: "power1.inOut", // Use a smooth ease in and out
stagger: 0.01, // Apply a small delay between each particle animation
repeat: -1, // Repeat the animation indefinitely
yoyo: true // Make the animation play in reverse
});
}
// Create particles and start the animation when the window loads
window.onload = function() {
const particleCount = 500;
for (let i = 0; i < particleCount; i++) {
createParticle();
}
animateParticles();
};
</script>
</body>
</html>