Asynchronous Triggered Animations

Hello, I’m wondering on the best way to start an animation that is asynchronously triggered by user actions. Playground is a rough mock-up of the concept-- basically the user will interact with something in the HTML (not the canvas!) and trigger a flag that should cause the animation to run on the next frame.

Oddly, using BABYLON.Animation.CreateAndStartAnimation as opposed to scene.beginDirectAnimation appears to work. However, I would prefer to use the later as it has more flexibility in how it operates (and I can define the animation elsewhere) if possible. Any ideas where I’m going wrong? --> onBeforeAnimationsObservable version

the scene.beginDirectAnimation expects an array of animations:

1 Like

Ah, indeed it does. Thanks for the help!

1 Like