跳跃式位置移动,暂不平滑,观感尚可

This commit is contained in:
WindowBird 2025-11-03 09:29:12 +08:00
parent 9169b7e838
commit ef7c28c767

View File

@ -301,19 +301,20 @@ const resetToCenter = () => {
setTimeout(() => {
isAnimating.value = false;
}, 1000);
}, 300); // transition 0.3s
};
//
const slideToPreviousDay = () => {
isAnimating.value = true;
// -screenWidth * 2
// const targetX = -screenWidth.value*2;
// translateX.value = targetX;
const targetX = -screenWidth.value;
translateX.value = targetX;
// 300ms transition
setTimeout(() => {
// transition
// isAnimating.value = false;
isAnimating.value = false;
// transition
setTimeout(() => {
@ -327,18 +328,18 @@ const slideToPreviousDay = () => {
baseTranslateX.value = -screenWidth.value;
console.log(`日期切换:上一天,新日期:${selectedDate.value}`);
}, 16); // transition
}, 1000);
isAnimating.value = false;
}, 0); // transition
}, 300); // transition 0.3s
};
//
const slideToNextDay = () => {
isAnimating.value = true;
// 0
// const targetX = 0;
// translateX.value = targetX;
const targetX = -screenWidth.value;
translateX.value = targetX;
// 300ms transition
setTimeout(() => {
// transition
isAnimating.value = false;
@ -356,7 +357,7 @@ const slideToNextDay = () => {
console.log(`日期切换:下一天,新日期:${selectedDate.value}`);
}, 16); // transition
}, 300);
}, 300); // transition 0.3s
};
//