我有一个动画,当我按下连接的 uibutton 时,动画会播放,但是,动画第一次播放时它在开始之前会有一点延迟。
在 js 文件中,我将有五个动画,因此单击它会连续播放。
我怎样才能消除这种延迟?
谢谢!
const animationList = ['Idle_static', 'open', 'close', 'popup']
let idx = 1 // Start with the 2nd animation because the model starts with idle animation
const nextAnimation = () => {
newElement.setAttribute('animation-mixer', {
clip: animationList[idx],
repetitions: 1,
crossFadeDuration: 0.4,
clampWhenFinished: true,
})
idx = (idx + 1) % animationList.length
}
nextButton.onclick = nextAnimation