Skip to content

Commit 0a0ddea

Browse files
feat: add neon-tunnel animation by bhupeshk3014 (#2999)
Co-authored-by: Laureline Paris <laurelinedev@gmail.com>
1 parent ef8b1ce commit 0a0ddea

3 files changed

Lines changed: 116 additions & 0 deletions

File tree

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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>Neon Tunnel</title>
7+
<link rel="stylesheet" href="./styles.css" />
8+
</head>
9+
<body>
10+
<div class="stage">
11+
<div class="tunnel" aria-label="Neon tunnel animation" role="img">
12+
<span class="ring" style="--i:0"></span>
13+
<span class="ring" style="--i:1"></span>
14+
<span class="ring" style="--i:2"></span>
15+
<span class="ring" style="--i:3"></span>
16+
<span class="ring" style="--i:4"></span>
17+
<span class="ring" style="--i:5"></span>
18+
<span class="ring" style="--i:6"></span>
19+
<span class="ring" style="--i:7"></span>
20+
<span class="ring" style="--i:8"></span>
21+
<span class="ring" style="--i:9"></span>
22+
<span class="ring" style="--i:10"></span>
23+
<span class="ring" style="--i:11"></span>
24+
<span class="ring" style="--i:12"></span>
25+
<span class="ring" style="--i:13"></span>
26+
</div>
27+
</div>
28+
</body>
29+
</html>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"artName": "neon-tunnel",
3+
"githubHandle": "bhupeshk3014"
4+
}
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
:root{
2+
--bg: #070b18;
3+
--glowA: #6aa9ff;
4+
--glowB: #9b6bff;
5+
--glowC: #ff6ad5;
6+
--glowD: #7fffd4;
7+
}
8+
9+
*{ box-sizing: border-box; }
10+
html, body{
11+
height: 100%;
12+
margin: 0;
13+
background: radial-gradient(1100px 700px at 50% 42%, #0c1230, var(--bg));
14+
color: #e9eefc;
15+
font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial;
16+
}
17+
18+
.stage{
19+
position: fixed; inset: 0;
20+
display: grid; place-items: center;
21+
}
22+
23+
.tunnel{
24+
position: relative;
25+
width: min(540px, 92vw);
26+
height: min(540px, 92vw);
27+
border-radius: 18px;
28+
overflow: hidden;
29+
background:
30+
radial-gradient(85% 65% at 50% 55%, #0b122d 0, #081025 60%, #070b18 100%),
31+
radial-gradient(#ffffff15 1px, transparent 1px); /* faint speckles */
32+
background-size: auto, 3px 3px;
33+
background-position: 0 0, 0 0;
34+
filter: drop-shadow(0 20px 60px #0008);
35+
transform: perspective(900px) rotateX(22deg);
36+
animation: sway 8s ease-in-out infinite alternate;
37+
}
38+
39+
.ring{
40+
--h: calc(200 + 20 * var(--i)); /* hue-ish variation for fun if using hsl */
41+
--c: hsl(var(--h), 90%, 70%); /* base color per ring */
42+
--glow: 0 0 10px var(--c), 0 0 24px var(--c), 0 0 48px var(--c);
43+
44+
position: absolute; left: 50%; top: 50%;
45+
width: 25vmin; height: 25vmin; /* base size before scaling */
46+
transform: translate(-50%, -50%) scale(0.25);
47+
border-radius: 50%;
48+
background:
49+
radial-gradient(circle at 50% 50%, transparent 58%, var(--c) 60% 63%, transparent 66%),
50+
conic-gradient(from 0deg,
51+
transparent 0 10deg, rgba(255,255,255,.25) 10deg 12deg, transparent 12deg 24deg,
52+
rgba(255,255,255,.15) 24deg 26deg, transparent 26deg 36deg,
53+
rgba(255,255,255,.2) 36deg 38deg, transparent 38deg 48deg);
54+
mix-blend-mode: screen;
55+
box-shadow: var(--glow);
56+
filter: saturate(140%);
57+
opacity: 0;
58+
animation:
59+
fly 2.8s linear infinite,
60+
spin 6s linear infinite;
61+
animation-delay: calc(var(--i) * -0.2s);
62+
}
63+
64+
@keyframes fly{
65+
0% { opacity: 0; transform: translate(-50%,-50%) scale(0.15); }
66+
8% { opacity: .85; }
67+
70% { opacity: .9; transform: translate(-50%,-50%) scale(1.25); }
68+
100% { opacity: 0; transform: translate(-50%,-50%) scale(1.4); }
69+
}
70+
71+
@keyframes spin{
72+
to { transform: translate(-50%,-50%) scale(var(--s,1)) rotate(360deg); }
73+
}
74+
75+
@keyframes sway{
76+
from{ transform: perspective(900px) rotateX(22deg) rotateZ(-3deg); }
77+
to { transform: perspective(900px) rotateX(22deg) rotateZ( 3deg); }
78+
}
79+
80+
@media (prefers-reduced-motion: reduce){
81+
.tunnel{ animation: none; }
82+
.ring{ animation: none; opacity: 1; transform: translate(-50%,-50%) scale(1); }
83+
}

0 commit comments

Comments
 (0)