-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsplash.html
More file actions
127 lines (107 loc) · 3.38 KB
/
splash.html
File metadata and controls
127 lines (107 loc) · 3.38 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Full Screen Splash</title>
<style>
html,
body {
margin: 0;
padding: 0;
width: 100%;
height: 100%;
background: radial-gradient(circle at center, #111 0%, #000 100%);
overflow: hidden;
}
.splash {
position: relative;
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
}
.logo {
width: 200px;
height: 200px;
background: url('static/salati-app-icon.png') no-repeat center/contain;
z-index: 10;
}
.particle {
position: absolute;
width: 8px;
height: 8px;
border-radius: 50%;
opacity: 0;
pointer-events: none;
}
</style>
</head>
<body>
<div class="splash">
<div class="logo"></div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.5/gsap.min.js"></script>
<script>
const splash = document.querySelector('.splash');
const centerX = window.innerWidth / 2;
const centerY = window.innerHeight / 2;
const colors = ["#ffcc00", "#ff4444", "#44ccff", "#ffffff", "#ff66cc"];
const particles = [];
for (let i = 0; i < 200; i++) {
const p = document.createElement('div');
p.classList.add('particle');
p.style.background = colors[Math.floor(Math.random() * colors.length)];
splash.appendChild(p);
const angle = Math.random() * Math.PI * 2;
const speed = Math.random() * 500 + 150;
const vx = Math.cos(angle) * speed;
const vy = Math.sin(angle) * speed - 250;
particles.push({
el: p,
x: centerX,
y: centerY,
vx,
vy,
opacity: 1,
size: Math.random() * 6 + 4
});
p.style.width = p.style.height = particles[particles.length - 1].size + "px";
}
gsap.ticker.add(() => {
particles.forEach((particle, index) => {
particle.vy += 15;
particle.vx *= 0.97;
particle.vy *= 0.97;
particle.x += particle.vx * 0.016;
particle.y += particle.vy * 0.016;
particle.opacity -= 0.006;
particle.el.style.transform = `translate(${particle.x}px, ${particle.y}px)`;
particle.el.style.opacity = particle.opacity;
if (particle.opacity <= 0) {
particle.el.remove();
particles.splice(index, 1);
}
});
if (particles.length === 0) {
gsap.ticker.removeAll();
}
});
gsap.from(".logo", {
scale: 0,
opacity: 0,
duration: 1.8,
ease: "elastic.out(1, 0.5)"
});
gsap.to(".logo", {
opacity: 0,
duration: 1.2,
delay: 5,
ease: "power2.in",
onComplete: () => {
document.querySelector('.splash').style.display = 'none';
}
});
</script>
</body>
</html>