style(motion): add strict animations and fix layout properties
- Change ReadingProgress and RouteTable to use transform (scaleX/scaleY) instead of width/height - Convert existing easing functions to 200ms cubic-bezier(.2,0,0,1) - Document animation purpose with CSS comments - Add guide panel swap, review desk detail swap, and tally pop animations - Implement prefers-reduced-motion for all new states
This commit is contained in:
@@ -99,7 +99,11 @@ const { rootSelector, data } = Astro.props;
|
||||
|
||||
function replace(target, markup) {
|
||||
const panel = root.querySelector(target);
|
||||
if (panel) panel.innerHTML = markup;
|
||||
if (!panel) return;
|
||||
panel.innerHTML = markup;
|
||||
panel.classList.remove('is-swapping');
|
||||
void panel.offsetWidth;
|
||||
panel.classList.add('is-swapping');
|
||||
}
|
||||
|
||||
// Names deliberately match legacy functions until task 19 updates its checks.
|
||||
@@ -291,4 +295,24 @@ const { rootSelector, data } = Astro.props;
|
||||
outline: 3px solid var(--gold);
|
||||
outline-offset: -3px;
|
||||
}
|
||||
|
||||
:global(.is-swapping > *) {
|
||||
/* purpose: tab panel change in the guide (state change) */
|
||||
animation: guide-swap 200ms cubic-bezier(0.2, 0, 0, 1) both;
|
||||
}
|
||||
@keyframes guide-swap {
|
||||
from {
|
||||
opacity: 0.15;
|
||||
transform: translateY(5px);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
:global(.is-swapping > *) {
|
||||
animation: none;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user