0

I have an animation, when I press a connected uibutton the animation plays, however, the first time the animation plays it has a slight delay before it starts.

On the js file I will have five of animations so clicking it plays consecutively.

How can I remove this delay?

Thanks!

   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
Muthu Kv
  • 31
  • 4
  • 1
    Hi, and welcome to Stack Overflow. Please, post some code what have you tried so far. – Samuli Hakoniemi Oct 13 '20 at 09:42
  • 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 – Muthu Kv Oct 14 '20 at 05:59

1 Answers1

1

First upload your model to one of the online glb previewer tools to see if the delay is also see there when you play/switch animations.

https://gltf-viewer.donmccurdy.com/

https://www.creators3d.com/online-viewer

Also, try using the Facebook fbx -> glb converter. Some of the other converters don’t handle animation timelines correctly. Link to it and other converter tools can be found at https://www.8thwall.com/glb

atomarch
  • 276
  • 1
  • 7
  • Thanks for the reply, the facebook converter does not export animation but the problem solved by i am removing the attribute when playing the animation and i will add animation mixer component again. – Muthu Kv Oct 20 '20 at 06:58