Detect MMD animation is end or not

MMD animation will loop after ended. Is there any way to stop the loop?
I don’t want the animation loop again. Just play one time.
I can just pause/play when the animation is not ended, but I don’t know how to detect the whole animation is ended or not.
Hope someone know the answer. A lot of thanks!

Here is the code.

function animate() {

	requestAnimationFrame( animate );
	render();
	
}

function render() {

	if (status == "play"){
		helper.update( clock.getDelta() );							
	}

	effect.render( scene, camera );
}

MMD animation will loop after ended. Is there any way to stop the loop?

to avoid loop you need to set the repetitions in your mixer

your_mixer_var=helper.objects.get(variable_model);
your_mixer_var.mixer.clipAction(animation_name_or_path).repetitions=0;

how to detect the whole animation is ended or not?

you need a eventListener

your_mixer_var.addEventListener( ‘finished’, a_variable = (e)=>
{
//YOUR CODE HERE (will run when the animation has ended)

//**remember delete the addeventlistiner to avoid multiple instances
your_mixer_var.removeEventListener(‘finished’, a_variable);
});

OTHER WAY

You can use addEventlistener loop to detect when is looping and stop the animation

your_mixer_var.addEventListener( ‘loop’, your_variable_loop = (e)=> {

//This code runs in every loop

your_mixer_var.clipAction(animation_name_or_path).stop();

//IF your want detroy the loop listener
//**remember delete the addeventlistiner to avoid multiple instances

your_mixer_var.removeEventListener(‘loop’,your_variable_loop);
});

for more info look the documentation for AnimationAction

https://threejs.org/docs/?q=animation#api/en/animation/AnimationAction

:3