perf: frame-rate independent animation + Scroll-Driven progress bar

- MatrixRain: add delta time for consistent speed across 60/120/144Hz displays
- ReadingProgress: use Scroll-Driven Animations API with JS fallback
- Fallback to scroll events for unsupported browsers (Firefox) and prefers-reduced-motion

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-02-14 00:02:35 +08:00
parent f185048abc
commit d5ea352775
3 changed files with 65 additions and 13 deletions

View File

@@ -97,6 +97,17 @@
}
}
/* Reading progress bar - Scroll-Driven Animations API (Chrome 115+, Safari 26+, Edge 115+) */
@keyframes reading-progress-grow {
from { transform: scaleX(0); }
to { transform: scaleX(1); }
}
.reading-progress-bar-scroll-driven {
animation: reading-progress-grow auto linear forwards;
animation-timeline: scroll(block root);
}
:root {
--motion-duration-short: 180ms;
--motion-duration-medium: 260ms;