Replace default leaves with precipitation and procedural snowdrifts
This commit is contained in:
1 parent
2c17a52b5e
commit
c85876f1db
13 files changed
+329
-83
No files matched your search
+37
-31
@@ -1,5 +1,5 @@
|
||||
/* Shared by calculator and admin. Keep all particles below interactive content. */
|
||||
.leaf-field {
|
||||
/* Shared precipitation layer; no decorative particles without reported precipitation. */
|
||||
.weather-field {
|
||||
--rain: #69849a;
|
||||
--snow: #fffefa;
|
||||
--snow-edge: #aab9c5;
|
||||
@@ -9,50 +9,28 @@
|
||||
pointer-events: none;
|
||||
z-index: 0;
|
||||
}
|
||||
.leaf {
|
||||
.weather-particle {
|
||||
position: absolute;
|
||||
top: -3rem;
|
||||
width: 1.1rem;
|
||||
height: 1.65rem;
|
||||
border-radius: 100% 0 100% 0;
|
||||
background: var(--leaf, var(--accent));
|
||||
box-shadow: inset .18rem -.12rem 0 #8e431d;
|
||||
opacity: .68;
|
||||
animation: leaf-fall var(--duration, 15s) linear infinite;
|
||||
animation: snow-fall var(--duration, 12s) linear infinite;
|
||||
}
|
||||
.leaf:nth-child(2n) { background: var(--gold); width: .82rem; height: 1.3rem; --duration: 19s; }
|
||||
.leaf:nth-child(3n) { background: #a84e22; width: 1.35rem; height: 1.85rem; --duration: 22s; }
|
||||
.leaf:nth-child(1) { left: 7%; animation-delay: -4s; }
|
||||
.leaf:nth-child(2) { left: 18%; animation-delay: -12s; }
|
||||
.leaf:nth-child(3) { left: 32%; animation-delay: -7s; }
|
||||
.leaf:nth-child(4) { left: 49%; animation-delay: -16s; }
|
||||
.leaf:nth-child(5) { left: 64%; animation-delay: -2s; }
|
||||
.leaf:nth-child(6) { left: 78%; animation-delay: -10s; }
|
||||
.leaf:nth-child(7) { left: 91%; animation-delay: -18s; }
|
||||
.leaf[data-kind="snow"] {
|
||||
.weather-particle[data-kind="snow"] {
|
||||
width: calc(.45rem * var(--size));
|
||||
height: calc(.45rem * var(--size));
|
||||
border-radius: 50%;
|
||||
background: var(--snow);
|
||||
box-shadow: 0 0 2px var(--snow-edge);
|
||||
opacity: .85;
|
||||
animation-name: snow-fall;
|
||||
}
|
||||
.leaf[data-kind="rain"] {
|
||||
.weather-particle[data-kind="rain"] {
|
||||
width: 1.5px;
|
||||
height: calc(1.6rem * var(--size));
|
||||
border-radius: 2px;
|
||||
background: var(--rain);
|
||||
box-shadow: none;
|
||||
opacity: .4;
|
||||
animation-name: rain-fall;
|
||||
}
|
||||
.weather-paused .leaf { animation-play-state: paused; }
|
||||
@keyframes leaf-fall {
|
||||
0% { transform: translate3d(0, -4rem, 0) rotate(20deg); }
|
||||
45% { transform: translate3d(calc(3.5rem + var(--drift, 0vw) * .45), 48vh, 0) rotate(170deg); }
|
||||
100% { transform: translate3d(calc(-4rem + var(--drift, 0vw)), 112vh, 0) rotate(330deg); }
|
||||
}
|
||||
.weather-paused .weather-particle { animation-play-state: paused; }
|
||||
@keyframes snow-fall {
|
||||
0% { transform: translate3d(0, -4rem, 0); }
|
||||
50% { transform: translate3d(calc(2rem + var(--drift, 0vw) * .5), 50vh, 0); }
|
||||
@@ -62,7 +40,35 @@
|
||||
from { transform: translate3d(0, -4rem, 0) rotate(calc(-1 * var(--rain-angle, 0deg))); }
|
||||
to { transform: translate3d(var(--drift, 0vw), 112vh, 0) rotate(calc(-1 * var(--rain-angle, 0deg))); }
|
||||
}
|
||||
.snow-footer {
|
||||
--snow-shade: #e8eef0;
|
||||
--snow-ridge: #f4f7f7;
|
||||
--snow-front: #fffefa;
|
||||
margin-top: 48px;
|
||||
padding-top: 18px;
|
||||
border-top: 1px solid var(--line);
|
||||
color: var(--muted);
|
||||
font-size: .9rem;
|
||||
}
|
||||
.snow-footer a { color: inherit; text-underline-offset: 3px; }
|
||||
.snow-footer a:hover { color: var(--accent); }
|
||||
.snow-footer a:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; }
|
||||
.snow-cover-caption { min-height: 24px; margin-top: 8px; font-size: .8rem; line-height: 1.5; }
|
||||
.footer-snowdrift {
|
||||
height: var(--snow-height, 0px);
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
pointer-events: none;
|
||||
}
|
||||
.footer-snowdrift svg { display: block; width: 100%; height: 100%; }
|
||||
.snow-bank-shade { fill: var(--snow-shade); }
|
||||
.snow-bank-ridge { fill: none; stroke: var(--snow-ridge); stroke-width: 2; stroke-linecap: round; }
|
||||
.weather-page main { margin-bottom: 0; padding-bottom: 0; }
|
||||
.snow-bank-front { fill: var(--snow-front); }
|
||||
@media (max-width: 600px) {
|
||||
.snow-footer { margin-top: 32px; }
|
||||
}
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.leaf-field .leaf { animation: none; top: 8vh; opacity: .16; }
|
||||
.leaf:nth-child(n+8) { display: none; }
|
||||
.weather-field .weather-particle { animation: none; top: 8vh; opacity: .16; }
|
||||
.weather-particle:nth-child(n+8) { display: none; }
|
||||
}
|
||||
Reference in new issue
Block a user