Skip to content

Commit 56da450

Browse files
feat: add digital-rain animation by bhupeshk3014 (#3001)
Co-authored-by: Laureline Paris <laurelinedev@gmail.com>
1 parent efebe29 commit 56da450

3 files changed

Lines changed: 181 additions & 0 deletions

File tree

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1" />
6+
<title>Digital Rain</title>
7+
<link rel="stylesheet" href="./styles.css" />
8+
</head>
9+
<body>
10+
<div class="stage">
11+
<div class="matrix" aria-label="Digital rain animation" role="img">
12+
<!-- 24 columns; timing is staggered via --i -->
13+
<span class="col" style="--i:0"></span>
14+
<span class="col" style="--i:8"></span>
15+
<span class="col" style="--i:9"></span>
16+
<span class="col" style="--i:10"></span>
17+
<span class="col" style="--i:11"></span>
18+
<span class="col" style="--i:12"></span>
19+
<span class="col" style="--i:13"></span>
20+
<span class="col" style="--i:14"></span>
21+
<span class="col" style="--i:15"></span>
22+
<span class="col" style="--i:1"></span>
23+
<span class="col" style="--i:2"></span>
24+
<span class="col" style="--i:3"></span>
25+
<span class="col" style="--i:18"></span>
26+
<span class="col" style="--i:19"></span>
27+
<span class="col" style="--i:20"></span>
28+
<span class="col" style="--i:21"></span>
29+
<span class="col" style="--i:22"></span>
30+
<span class="col" style="--i:18"></span>
31+
<span class="col" style="--i:19"></span>
32+
<span class="col" style="--i:20"></span>
33+
<span class="col" style="--i:21"></span>
34+
<span class="col" style="--i:22"></span>
35+
<span class="col" style="--i:4"></span>
36+
<span class="col" style="--i:5"></span>
37+
<span class="col" style="--i:6"></span>
38+
<span class="col" style="--i:7"></span>
39+
<span class="col" style="--i:16"></span>
40+
<span class="col" style="--i:17"></span>
41+
<span class="col" style="--i:18"></span>
42+
<span class="col" style="--i:19"></span>
43+
<span class="col" style="--i:20"></span>
44+
<span class="col" style="--i:21"></span>
45+
<span class="col" style="--i:22"></span>
46+
<span class="col" style="--i:23"></span>
47+
<span class="col" style="--i:18"></span>
48+
<span class="col" style="--i:19"></span>
49+
<span class="col" style="--i:20"></span>
50+
<span class="col" style="--i:21"></span>
51+
<span class="col" style="--i:22"></span>
52+
<span class="col" style="--i:23"></span>
53+
<span class="col" style="--i:18"></span>
54+
<span class="col" style="--i:19"></span>
55+
<span class="col" style="--i:20"></span>
56+
<span class="col" style="--i:21"></span>
57+
<span class="col" style="--i:22"></span>
58+
<span class="col" style="--i:18"></span>
59+
<span class="col" style="--i:19"></span>
60+
<span class="col" style="--i:20"></span>
61+
<span class="col" style="--i:21"></span>
62+
<span class="col" style="--i:22"></span>
63+
</div>
64+
</div>
65+
</body>
66+
</html>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"artName": "digital-rain",
3+
"githubHandle": "bhupeshk3014"
4+
}
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
/* Digital Rain — pure CSS (no JS/images), accessible, reduced-motion friendly */
2+
3+
:root{
4+
--bg: #070b18;
5+
--panel-1: #0c1434;
6+
--panel-2: #0a1128;
7+
--glyph-dim: #1cff6a;
8+
--glyph-bright: #caffde;
9+
}
10+
11+
*{ box-sizing: border-box; }
12+
html, body{
13+
height: 100%;
14+
margin: 0;
15+
background: radial-gradient(1200px 800px at 50% 42%, #0f1942, var(--bg));
16+
color: #e9eefc;
17+
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
18+
}
19+
20+
.stage{
21+
position: fixed; inset: 0;
22+
display: grid; place-items: center;
23+
}
24+
25+
/* Framed scene with subtle star specks */
26+
.matrix{
27+
position: relative;
28+
width: min(860px, 92vw);
29+
height: min(520px, 68vh);
30+
border-radius: 18px;
31+
overflow: hidden;
32+
background:
33+
radial-gradient(90% 65% at 50% 55%, var(--panel-1) 0, var(--panel-2) 60%, #070b18 100%),
34+
radial-gradient(#ffffff20 1px, transparent 1px);
35+
background-size: auto, 3px 3px;
36+
background-position: 0 0, 0 0;
37+
box-shadow: 0 24px 72px #000a, inset 0 0 80px #0b102888;
38+
filter: saturate(120%);
39+
}
40+
41+
/* Lay columns using grid so spacing scales with width */
42+
.matrix{
43+
display: grid;
44+
grid-auto-flow: column;
45+
grid-auto-columns: 1.35ch;
46+
gap: 0.65ch;
47+
align-items: stretch;
48+
padding: 18px 14px;
49+
}
50+
51+
/* Each column is a clipping window; text scrolls inside the ::before */
52+
.col{
53+
position: relative;
54+
height: 100%;
55+
overflow: hidden;
56+
isolation: isolate; /* let ::after blend without affecting neighbors */
57+
}
58+
59+
/* Long “stream” of glyphs (katakana + latin + digits), written vertically */
60+
.col::before{
61+
content:
62+
"アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワン"
63+
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
64+
"アカサタナハマヤラ0123456789タチツテトABCDEFウエオ"
65+
"MNOPQRSTUVWXハヒフヘホYZ0123456789"
66+
"アイウエオヤユヨワン0123456789ABCDEFGHJKLMNPQRSTUVWXZ";
67+
position: absolute;
68+
left: 0; top: -110%; /* start above the window */
69+
display: inline-block;
70+
min-height: 220%; /* long enough to scroll */
71+
writing-mode: vertical-rl;
72+
text-orientation: upright;
73+
font-size: 16px;
74+
line-height: 1.08;
75+
letter-spacing: 0.06em;
76+
color: #0cff66;
77+
text-shadow:
78+
0 0 8px #00ff88,
79+
0 0 16px #00ff88;
80+
transform: translateY(0);
81+
animation: rain var(--dur, 7s) linear infinite;
82+
animation-delay: calc(var(--i) * -0.25s);
83+
/* fade top & bottom edges inside the window */
84+
-webkit-mask: linear-gradient(180deg, transparent 0 6%, #000 12% 88%, transparent 94% 100%);
85+
mask: linear-gradient(180deg, transparent 0 6%, #000 12% 88%, transparent 94% 100%);
86+
}
87+
88+
/* Column-specific timing (varies duration a little for organic look) */
89+
.col:nth-child(odd)::before { animation-duration: 7.6s; }
90+
.col:nth-child(even)::before{ animation-duration: 6.8s; }
91+
.col:nth-child(3n)::before { animation-duration: 7.9s; }
92+
93+
.col:nth-child(odd)::after { animation-duration: 7.6s; }
94+
.col:nth-child(even)::after { animation-duration: 6.8s; }
95+
.col:nth-child(3n)::after { animation-duration: 7.9s; }
96+
97+
/* Motion */
98+
@keyframes rain{
99+
from{ transform: translateY(0); }
100+
to { transform: translateY(110%); } /* scroll fully through */
101+
}
102+
@keyframes head{
103+
from{ top: -18%; }
104+
to { top: 100%; }
105+
}
106+
107+
/* Reduce motion: show a calm, readable grid */
108+
@media (prefers-reduced-motion: reduce){
109+
.col::before, .col::after { animation: none !important; top: 0; }
110+
.col::after{ display: none; }
111+
}

0 commit comments

Comments
 (0)