Skip to content

Commit b00d975

Browse files
perf(swup): 优化页面切换速度
- 动画时长从 180ms 缩短到 120ms - 始终开启 swup 缓存 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent d7a03ea commit b00d975

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

astro.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export default defineConfig({
4646
animationClass: "transition-swup-",
4747
containers: ["main"],
4848
smoothScrolling: false, // 禁用平滑滚动以提升性能,避免与锚点导航冲突
49-
cache: process.env.NODE_ENV === "production",
49+
cache: true,
5050
preload: true, // swup 默认鼠标悬停预加载
5151
accessibility: true,
5252
updateHead: process.env.NODE_ENV === "production",

src/scripts/core/swup-config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ export interface TransitionConfig {
5353
staggerDelay: number;
5454
}
5555

56-
// 过渡动画默认配置 - 灵感来自 Firefly 主题的快速流畅体验
56+
// 过渡动画默认配置
5757
export const TRANSITION_CONFIG: TransitionConfig = {
58-
duration: 180,
58+
duration: 120,
5959
easing: "cubic-bezier(0.25, 0.46, 0.45, 0.94)",
6060
easingOut: "cubic-bezier(0.55, 0.055, 0.675, 0.19)",
6161
translateDistance: "1.5rem",

src/styles/_transition-vars.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*/
55

66
:root {
7-
--transition-duration: 180ms;
7+
--transition-duration: 120ms;
88
--transition-easing: cubic-bezier(0.25, 0.46, 0.45, 0.94);
99
--transition-easing-out: cubic-bezier(0.55, 0.055, 0.675, 0.19);
1010
--transition-translate: 1.5rem;

0 commit comments

Comments
 (0)