feat: fade meteors at horizon using mask-image on #meteorLayer
Meteors now dissolve as they approach the horizon line (fade from 50% to 60% viewport height) via CSS mask-image on their container. Also fixed spawnMeteor appending to #meteorLayer instead of .scene. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
238c56eba4
commit
fd4ba05d1e
1 changed files with 12 additions and 1 deletions
|
|
@ -121,6 +121,14 @@ html, body {
|
||||||
transform-origin: top center;
|
transform-origin: top center;
|
||||||
animation: meteorFall linear forwards;
|
animation: meteorFall linear forwards;
|
||||||
}
|
}
|
||||||
|
#meteorLayer {
|
||||||
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
|
pointer-events: none;
|
||||||
|
-webkit-mask-image: linear-gradient(to bottom, black 50%, transparent 60%);
|
||||||
|
mask-image: linear-gradient(to bottom, black 50%, transparent 60%);
|
||||||
|
}
|
||||||
|
|
||||||
@keyframes meteorFall {
|
@keyframes meteorFall {
|
||||||
0% { opacity: 0; transform: rotate(var(--rot)) translateY(0); }
|
0% { opacity: 0; transform: rotate(var(--rot)) translateY(0); }
|
||||||
5% { opacity: 1; }
|
5% { opacity: 1; }
|
||||||
|
|
@ -745,6 +753,9 @@ html, body {
|
||||||
<!-- Horizon glow -->
|
<!-- Horizon glow -->
|
||||||
<div class="horizon"></div>
|
<div class="horizon"></div>
|
||||||
|
|
||||||
|
<!-- Meteor layer (masked at horizon) -->
|
||||||
|
<div id="meteorLayer"></div>
|
||||||
|
|
||||||
<!-- ===================== ROBOT ===================== -->
|
<!-- ===================== ROBOT ===================== -->
|
||||||
<div class="robot-wrap">
|
<div class="robot-wrap">
|
||||||
<div class="beat-wrap">
|
<div class="beat-wrap">
|
||||||
|
|
@ -919,7 +930,7 @@ function spawnMeteor() {
|
||||||
animation-duration:${dur}s;
|
animation-duration:${dur}s;
|
||||||
animation-name:meteorFall;
|
animation-name:meteorFall;
|
||||||
`;
|
`;
|
||||||
document.querySelector('.scene').appendChild(el);
|
document.getElementById('meteorLayer').appendChild(el);
|
||||||
setTimeout(() => el.remove(), dur * 1000);
|
setTimeout(() => el.remove(), dur * 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue