Diagonal meteor beams
斜向流星光束
Sweep slender luminous streaks diagonally across a dark backdrop with zero JS.
Also searched as: 斜线流星划过背景, 暗夜背景斜向光束, Linear 流星背景, Meteor Shower
- Placement
- Background
- Mood
- Technical, Refined
- Trigger
- 一直循环
- Site types
- 品牌官网, 工具和应用, 个人网站
How it works & accessibility
Places tilted CSS gradient streaks in a pointer-through isolated layer animating only translate and opacity along distance px with staggered proportional delays; reduced motion freezes subtle static beams.
Best for: Background (一直循环).
Reduced motion: 停止流星滑行循环,保留暗夜底纹与静止微弱斜向光痕
Mobile & touch: 仅驱动合成层 translate 与 opacity,在移动端保持低耗流畅
Key parameters
| Parameter | Key | Default | Range | Notes |
|---|---|---|---|---|
| 滑过时长 | duration | 3200ms | — | — |
| 滑行距离 | distance | 220px | — | — |
Ready-to-paste AI prompt
Add “Diagonal meteor beams” to the background in my project: Places tilted CSS gradient streaks in a pointer-through isolated layer animating only translate and opacity along distance px with staggered proportional delays; reduced motion freezes subtle static beams.
Parameters: duration: 3200ms, distance: 220px.
Preserve existing content and layout. Respect prefers-reduced-motion by showing the final state. Content must remain visible if JavaScript fails or is disabled.
Reference: https://donglang.linter.top/effects/meteor-beams.md (canonical specification and reference code).Dependency-free reference code
CSS
.mb-host {
position: relative;
overflow: hidden;
isolation: isolate;
--mb-duration: 3200ms;
--mb-distance: 220px;
}
.mb-sky {
position: absolute;
inset: -40% -20%;
z-index: 0;
transform: rotate(-35deg);
pointer-events: none;
}
.mb-sky > i {
position: absolute;
width: 78px;
height: 1.5px;
border-radius: 99px;
background: linear-gradient(90deg, transparent, currentColor);
animation: mb-glide var(--mb-duration) linear infinite;
}
.mb-sky > i:nth-child(1) { left: 8%; top: 24%; animation-delay: 0s; }
.mb-sky > i:nth-child(2) { left: 26%; top: 44%; animation-delay: calc(var(--mb-duration) * 0.18); }
.mb-sky > i:nth-child(3) { left: 16%; top: 66%; animation-delay: calc(var(--mb-duration) * 0.36); }
.mb-sky > i:nth-child(4) { left: 40%; top: 32%; animation-delay: calc(var(--mb-duration) * 0.54); }
.mb-sky > i:nth-child(5) { left: 32%; top: 78%; animation-delay: calc(var(--mb-duration) * 0.72); }
.mb-content {
position: relative;
z-index: 1;
}
@keyframes mb-glide {
0% {
translate: 0 0;
opacity: 0;
}
20% {
opacity: 1;
}
80% {
opacity: 1;
}
100% {
translate: var(--mb-distance) 0;
opacity: 0;
}
}
@media (prefers-reduced-motion: reduce) {
.mb-sky > i {
animation: none;
translate: calc(var(--mb-distance) * 0.35) 0;
opacity: 0.35;
}
}HTML
<section class="mb-host">
<div class="mb-sky" aria-hidden="true">
<i></i><i></i><i></i><i></i><i></i>
</div>
<div class="mb-content">
<h2>Precision Infrastructure</h2>
<p>斜向微光划过暗夜表面</p>
</div>
</section>