FadeIn and FadeOut needs stop last animation?

Hi.

I’m trying to crossfade 2 animations. First idle to walk after walk to idle, but when I try walk to idle the animation stops. So I need stop the animation that I interpolate to work.

Don’t work:

idle = model.mixer.clipAction( model.animations[ 0 ] );
walk = model.mixer.clipAction( model.animations[ 1 ] );
idle.play();

//CrossFade
walk.play();
idle.crossFadeTo(walk, 1);

//After 2 seconds, crossFade again
idle.play();
walk.crossFadeTo(idle,1);

Work:

idle = model.mixer.clipAction( model.animations[ 0 ] );
walk = model.mixer.clipAction( model.animations[ 1 ] );
idle.play();

//CrossFade
walk.play();
idle.crossFadeTo(walk, 1);
//wait time duration
setTimeout(function () {
        	idle.stop();
    	}, 1000);

//After 2 seconds, crossFade again
idle.play();
walk.crossFadeTo(idle,1);
//wait time duration
setTimeout(function () {
        	walk.stop();
    	}, 1000);

Is a limitation about CrossFade or has another way to make it?

Stopping the animation action should not be necessary. Can you reproduce the issue in a live demo? In any event, you can use the following example as an orientation where cross fading is demonstrated.

https://threejs.org/examples/#webgl_animation_skinning_blending

1 Like