Slider move when you press the Play button

Hello everyone friends!
How to make the slider move when you press the Play button?
How it is done in the Inspector panel (scene.debugLayer.show()) when playing an GroupAnimation.

For the button I use the following code:

playButton.onPointerClickObservable.add(function (value) {
animationGroup.loopAnimation = false;
animationGroup.play(true);
});

For slider:

slider.onValueChangedObservable.add(function (value) {

          header.text = "Current frame: " + ((value * 24) | 0);

          scene.animationGroups[0]

            .start(false, 1, value, value)

            .goToFrame(value);
        });

In this case, the slider is not associated with the button.

Welcome aboard!

You should provide a repro in the Playground (https://playground.babylonjs.com/), it will be easier for people to help.

@Evgeni_Popov thanks for the answer ))

https://playground.babylonjs.com/#68AHME#3

I want to get it like in the picture:

Here’s what the inspector is doing:

So, in your case, you could do something like:

https://playground.babylonjs.com/#68AHME#5

2 Likes

@Evgeni_Popov super, thank you very much ))