refactor(section): snap-out old section-body on navigation

The explicit fade-and-slide-left OLD animation left a visible ghost of the
previous section's content behind the incoming slide. Replacing it with an
instant opacity:0 keeps the transition clean while preserving the NEW
slide-in delay so the snap-out has a beat to register. Drops the now-dead
keyframes and --slide-section-body-out token.
This commit is contained in:
Ilia Mashkov
2026-05-23 09:53:26 +03:00
parent 82933dedf8
commit ecbb76312b
+8 -17
View File
@@ -96,7 +96,6 @@
--duration-spring: 220ms;
--delay-normal: 200ms;
--slide-section-body-in: clamp(1.25rem, 5vw, 3rem);
--slide-section-body-out: clamp(0.5rem, 1.5vw, 0.75rem);
}
@theme inline {
@@ -384,12 +383,13 @@
animation: none;
}
/* Section body slide-in from right */
/* Section body — snap OLD out and slide NEW in. Running an explicit OLD
* animation left a visible ghost of the previous section's content sitting
* behind the incoming slide; hiding it immediately keeps the transition
* clean and prevents the two-content overlap. */
::view-transition-old(section-body) {
animation-name: section-body-out;
animation-duration: var(--duration-normal);
animation-timing-function: var(--ease-default);
animation-fill-mode: both;
animation: none;
opacity: 0;
}
::view-transition-new(section-body) {
@@ -397,20 +397,11 @@
animation-duration: var(--duration-spring);
animation-timing-function: var(--ease-spring);
animation-fill-mode: both;
/* Hold the start-state for this delay before the slide-in begins — gives
* the snap-out a beat to register visually before new content arrives. */
animation-delay: var(--delay-normal);
}
@keyframes section-body-out {
from {
opacity: 1;
transform: translateX(0) scale(1);
}
to {
opacity: 0;
transform: translateX(calc(-1 * var(--slide-section-body-out))) scale(0.98);
}
}
@keyframes section-body-in {
from {
opacity: 0;