Animation controller question

Samba dance, I want to play the entire animation frame with just one click, rather than keep pressing ‘B’.
Is there a good implementation method replace setTimeout

Original code:

animating = true;

Simple implementation method:

const delay = sambaAnim.to / 60
      if(inputMap["b"]) {
          setTimeout(() => {
              animating = true
          }, delay * 1000)
      } else {
          animating = true
      }

Looks like you don’t need control in the renderLoop. Press the ‘f’ to start.
pg: https://playground.babylonjs.com/#AHQEIB#2148

3 Likes

This is indeed a good way