|
@@ -104,11 +104,6 @@ export function destroySmoothAnimation() {
|
|
|
aveSpeed: 0,
|
|
|
clientWidth: 0
|
|
|
})
|
|
|
- Object.assign(moveState, {
|
|
|
- oldIndex: -1,
|
|
|
- progress: 0,
|
|
|
- activeIndex: 0
|
|
|
- })
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -143,14 +138,7 @@ export function moveSmoothAnimationByPlayTime(time?: number) {
|
|
|
* progress 当前音符到下一个音符的距离百分比
|
|
|
* activeIndex 当前
|
|
|
*/
|
|
|
-const moveState = {
|
|
|
- oldIndex: -1, // 上一次index
|
|
|
- progress: 0,
|
|
|
- activeIndex: 0
|
|
|
-}
|
|
|
export function moveSmoothAnimation(progress: number, activeIndex: number, isMoveOsmd = true) {
|
|
|
- moveState.progress = progress
|
|
|
- moveState.activeIndex = activeIndex
|
|
|
// if (!smoothAnimationState.isShow.value) {
|
|
|
// return
|
|
|
// }
|
|
@@ -160,11 +148,6 @@ export function moveSmoothAnimation(progress: number, activeIndex: number, isMov
|
|
|
const progressCalcIndex = Math.round(progress * _numberOfSegments)
|
|
|
// // 当前的index
|
|
|
let nowIndex = nextPointsIndex - _numberOfSegments + progressCalcIndex
|
|
|
- // 当前计算的位置和上一次值一样时候不运行
|
|
|
- if (moveState.oldIndex === nowIndex) {
|
|
|
- return
|
|
|
- }
|
|
|
- moveState.oldIndex = nowIndex
|
|
|
const nowPointsPos = smoothAnimationState.pointsPos[nowIndex]
|
|
|
smoothAnimationState.canvasCtx?.clearRect(0, 0, smoothAnimationState.canvasDomWith, smoothAnimationState.canvasDomHeight)
|
|
|
// 移动
|