-
Notifications
You must be signed in to change notification settings - Fork 30
Open
Description
稍作修改,让左右动作变得更平滑
加入:
/**
* 左右动画时,一根棍的长度在gapCount次后渐渐变成下一根长度,越大动画越平滑。调大gapCount的同时,按倍数减小duration以保证播放速度不变
*/
var gapCount: Int = 1
private var gapIndex = 0
private var tempList: ArrayList = ArrayList()
——————————————————————————————
// val last = bodyWaveList.pollLast()
// bodyWaveList.addFirst(last)
修改为
if (gapIndex == 0) {
tempList.clear()
tempList.addAll(bodyWaveList)
}
val list = ArrayList<Double>()
tempList.forEachIndexed { index, i ->
val next = tempList[(index + tempList.size - 1) % tempList.size]
val value = i + ((next - i) / gapCount * (gapIndex + 1))
list.add(value)
}
bodyWaveList = list
gapIndex++
gapIndex %= gapCount
Metadata
Metadata
Assignees
Labels
No labels