|
@@ -74,7 +74,8 @@ export function initSmoothAnimation() {
|
|
}
|
|
}
|
|
return path
|
|
return path
|
|
}, 0)
|
|
}, 0)
|
|
- smoothAnimationState.aveSpeed = (canvasDomPath / (state.times[state.times.length - 1].time - state.times[0].time) / 1000) * 16.67
|
|
|
|
|
|
+ // 20 是屏幕多长时间刷新一次的时间,本来是16.67的,但是有些手机帧率比较低,所以这里给小一点的值,宁愿慢一点偏屏幕左边一点
|
|
|
|
+ smoothAnimationState.aveSpeed = (canvasDomPath / (state.times[state.times.length - 1].time - state.times[0].time) / 1000) * 20
|
|
// 当前屏幕的宽度
|
|
// 当前屏幕的宽度
|
|
calcClientWidth()
|
|
calcClientWidth()
|
|
window.addEventListener("resize", calcClientWidth)
|
|
window.addEventListener("resize", calcClientWidth)
|
|
@@ -129,7 +130,9 @@ export function moveSmoothAnimationByPlayTime(time?: number) {
|
|
(nextIndex > state.times.length - 1 ? state.times[state.activeNoteIndex]?.endtime : state.times[nextIndex].time) -
|
|
(nextIndex > state.times.length - 1 ? state.times[state.activeNoteIndex]?.endtime : state.times[nextIndex].time) -
|
|
state.times[state.activeNoteIndex]?.time
|
|
state.times[state.activeNoteIndex]?.time
|
|
// 当前时值在该区间的占比
|
|
// 当前时值在该区间的占比
|
|
- const playProgress = (currentTime - state.times[state.activeNoteIndex]?.time) / noteDuration
|
|
|
|
|
|
+ let playProgress = (currentTime - state.times[state.activeNoteIndex]?.time) / noteDuration
|
|
|
|
+ // 华为手机 fixtime 有个默认0.08的值,所以进度可能为负数 ,这里兼容一下
|
|
|
|
+ playProgress < 0 && (playProgress = 0)
|
|
moveSmoothAnimation(playProgress, state.activeNoteIndex)
|
|
moveSmoothAnimation(playProgress, state.activeNoteIndex)
|
|
}
|
|
}
|
|
|
|
|