src/components/hand-controls.js
function (gesture, lastGesture, reverse) {
    var clip;
    var fromAction;
    var mesh = this.el.getObject3D('mesh');
    var toAction;

    if (!mesh) { return; }

    // Stop all current animations.
    mesh.mixer.stopAllAction();

    // Grab clip action.
    clip = this.getClip(gesture);
    toAction = mesh.mixer.clipAction(clip);
    toAction.clampWhenFinished = true;
    toAction.loop = THREE.LoopRepeat;
    toAction.repetitions = 0;
    toAction.timeScale = reverse ? -1 : 1;
    toAction.time = reverse ? clip.duration : 0;
    toAction.weight = 1;

    // No gesture to gesture or gesture to no gesture.
    if (!lastGesture || gesture === lastGesture) {
      // Stop all current animations.
      mesh.mixer.stopAllAction();
      // Play animation.
      toAction.play();
      return;
    }

    // Animate or crossfade from gesture to gesture.
    clip = this.getClip(lastGesture);
    fromAction = mesh.mixer.clipAction(clip);
    fromAction.weight = 0.15;
    fromAction.play();
    toAction.play();
    fromAction.crossFadeTo(toAction, 0.15, true);
  }
function (gesture, lastGesture, reverse) {
    var clip;
    var fromAction;
    var mesh = this.el.getObject3D('mesh');
    var toAction;

    if (!mesh) { return; }

    // Stop all current animations.
    mesh.mixer.stopAllAction();

    // Grab clip action.
    clip = this.getClip(gesture);
    toAction = mesh.mixer.clipAction(clip);
    toAction.clampWhenFinished = true;
    toAction.loop = THREE.LoopRepeat;
    toAction.repetitions = 0;
    toAction.timeScale = reverse ? -1 : 1;
    toAction.time = reverse ? clip.duration : 0;
    toAction.weight = 1;

    // No gesture to gesture or gesture to no gesture.
    if (!lastGesture || gesture === lastGesture) {
      // Stop all current animations.
      mesh.mixer.stopAllAction();
      // Play animation.
      toAction.play();
      return;
    }

    // Animate or crossfade from gesture to gesture.
    clip = this.getClip(lastGesture);
    fromAction = mesh.mixer.clipAction(clip);
    fromAction.weight = 0.15;
    fromAction.play();
    toAction.play();
    fromAction.crossFadeTo(toAction, 0.15, true);
  }
function ( gesture , lastGesture , reverse ) { var clip ; var fromAction ; var mesh = this . el . getObject3D ( 'mesh' ) ; var toAction ; if ( ! mesh ) { return ; } // Stop all current animations. mesh . mixer . stopAllAction ( ) ; // Grab clip action. clip = this . getClip ( gesture ) ; toAction = mesh . mixer . clipAction ( clip ) ; toAction . clampWhenFinished = true ; toAction . loop = THREE . LoopRepeat ; toAction . repetitions = 0 ; toAction . timeScale = reverse ? - 1 : 1 ; toAction . time = reverse ? clip . duration : 0 ; toAction . weight = 1 ; // No gesture to gesture or gesture to no gesture. if ( ! lastGesture || gesture === lastGesture ) { // Stop all current animations. mesh . mixer . stopAllAction ( ) ; // Play animation. toAction . play ( ) ; return ; } // Animate or crossfade from gesture to gesture. clip = this . getClip ( lastGesture ) ; fromAction = mesh . mixer . clipAction ( clip ) ; fromAction . weight = 0.15 ; fromAction . play ( ) ; toAction . play ( ) ; fromAction . crossFadeTo ( toAction , 0.15 , true ) ; }
Play hand animation based on button state.

@param {string} gesture - Name of the animation as specified by the model.
@param {string} lastGesture - Previous pose.
@param {boolean} reverse - Whether animation should play in reverse.
Play hand animation based on button state .