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
|
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>2025 — Dropped</title>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link href="https://fonts.googleapis.com/css2?family=Londrina+Outline&display=swap" rel="stylesheet" />
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
background: #0a0a0a;
min-height: 100vh;
overflow: hidden;
font-family: "Londrina Outline", system-ui, sans-serif;
}
.container {
position: relative;
width: 100%;
height: 100vh;
}
.year {
position: absolute;
top: 10%;
left: 50%;
transform: translateX(-50%);
display: flex;
gap: 0.5vw;
}
.digit {
font-size: 22vw;
font-weight: 400;
color: #fff;
line-height: 1;
position: relative;
}
.year.dropping {
animation: drop 1.4s cubic-bezier(0.55, 0, 1, 0.45) forwards;
}
@keyframes drop {
0% {
top: 10%;
}
100% {
top: calc(100vh - 24vw);
}
}
.shard {
position: absolute;
font-size: 22vw;
font-weight: 400;
color: #fff;
line-height: 1;
font-family: "Londrina Outline", system-ui, sans-serif;
clip-path: polygon(var(--clip));
animation: shard-fall var(--duration) cubic-bezier(0.25, 0, 0.5, 1) forwards;
animation-delay: var(--delay);
opacity: 1;
}
@keyframes shard-fall {
0% {
transform: translate(0, 0) rotate(0deg);
opacity: 1;
}
100% {
transform: translate(var(--tx), var(--ty)) rotate(var(--rot));
opacity: 0;
}
}
.restart {
position: fixed;
bottom: 30px;
left: 50%;
transform: translateX(-50%);
background: transparent;
border: 1px solid #333;
color: #666;
padding: 10px 24px;
font-size: 14px;
cursor: pointer;
transition: all 0.2s;
opacity: 0;
z-index: 50;
}
.restart.visible {
opacity: 1;
}
.restart:hover {
border-color: #fff;
color: #fff;
}
</style>
</head>
<body>
<div class="container">
<div class="year" id="year">
<span class="digit" data-char="2">2</span>
<span class="digit" data-char="0">0</span>
<span class="digit" data-char="2">2</span>
<span class="digit" data-char="5">5</span>
</div>
</div>
<button class="restart" id="restart">drop again</button>
<script>
const year = document.getElementById("year");
const restartBtn = document.getElementById("restart");
const container = document.querySelector(".container");
const shardConfigs = [
{ clip: "0% 0%, 50% 0%, 30% 50%, 0% 40%", tx: -120, ty: 180, rot: -25 },
{ clip: "50% 0%, 100% 0%, 100% 35%, 60% 50%", tx: 80, ty: 200, rot: 35 },
{ clip: "0% 40%, 30% 50%, 40% 100%, 0% 100%", tx: -90, ty: 250, rot: -40 },
{ clip: "30% 50%, 60% 50%, 70% 100%, 40% 100%", tx: 20, ty: 300, rot: 10 },
{ clip: "60% 50%, 100% 35%, 100% 100%, 70% 100%", tx: 100, ty: 220, rot: 45 },
];
function createShards(digit, index) {
const rect = digit.getBoundingClientRect();
const char = digit.dataset.char;
shardConfigs.forEach((config, i) => {
const shard = document.createElement("span");
shard.className = "shard";
shard.textContent = char;
shard.style.left = rect.left + "px";
shard.style.top = rect.top + "px";
shard.style.setProperty("--clip", config.clip);
shard.style.setProperty("--tx", config.tx + (Math.random() - 0.5) * 60 + "px");
shard.style.setProperty("--ty", config.ty + Math.random() * 100 + "px");
shard.style.setProperty("--rot", config.rot + (Math.random() - 0.5) * 30 + "deg");
shard.style.setProperty("--duration", 1.2 + Math.random() * 0.6 + "s");
shard.style.setProperty("--delay", i * 0.02 + index * 0.05 + "s");
container.appendChild(shard);
});
}
function shatter() {
const digits = document.querySelectorAll(".digit");
digits.forEach((digit, index) => {
createShards(digit, index);
});
year.style.opacity = "0";
setTimeout(() => {
restartBtn.classList.add("visible");
}, 2000);
}
function startAnimation() {
document.querySelectorAll(".shard").forEach((s) => s.remove());
year.style.opacity = "1";
year.classList.remove("dropping", "shattered");
restartBtn.classList.remove("visible");
void year.offsetWidth;
year.classList.add("dropping");
year.addEventListener("animationend", function handler(e) {
if (e.animationName === "drop") {
year.removeEventListener("animationend", handler);
shatter();
}
});
}
restartBtn.addEventListener("click", startAnimation);
setTimeout(startAnimation, 500);
</script>
</body>
</html>
|