src/components/hand-controls.js
function (button, evt) {
    var lastGesture;
    var isPressed = evt === 'down';
    var isTouched = evt === 'touchstart';

    // Update objects.
    if (evt.indexOf('touch') === 0) {
      // Update touch object.
      if (isTouched === this.touchedButtons[button]) { return; }
      this.touchedButtons[button] = isTouched;
    } else {
      // Update button object.
      if (isPressed === this.pressedButtons[button]) { return; }
      this.pressedButtons[button] = isPressed;
    }

    // Determine the gesture.
    lastGesture = this.gesture;
    this.gesture = this.determineGesture();

    // Same gesture.
    if (this.gesture === lastGesture) { return; }
    // Animate gesture.
    this.animateGesture(this.gesture, lastGesture);

    // Emit events.
    this.emitGestureEvents(this.gesture, lastGesture);
  }
function (button, evt) {
    var lastGesture;
    var isPressed = evt === 'down';
    var isTouched = evt === 'touchstart';

    // Update objects.
    if (evt.indexOf('touch') === 0) {
      // Update touch object.
      if (isTouched === this.touchedButtons[button]) { return; }
      this.touchedButtons[button] = isTouched;
    } else {
      // Update button object.
      if (isPressed === this.pressedButtons[button]) { return; }
      this.pressedButtons[button] = isPressed;
    }

    // Determine the gesture.
    lastGesture = this.gesture;
    this.gesture = this.determineGesture();

    // Same gesture.
    if (this.gesture === lastGesture) { return; }
    // Animate gesture.
    this.animateGesture(this.gesture, lastGesture);

    // Emit events.
    this.emitGestureEvents(this.gesture, lastGesture);
  }
function ( button , evt ) { var lastGesture ; var isPressed = evt === 'down' ; var isTouched = evt === 'touchstart' ; // Update objects. if ( evt . indexOf ( 'touch' ) === 0 ) { // Update touch object. if ( isTouched === this . touchedButtons [ button ] ) { return ; } this . touchedButtons [ button ] = isTouched ; } else { // Update button object. if ( isPressed === this . pressedButtons [ button ] ) { return ; } this . pressedButtons [ button ] = isPressed ; } // Determine the gesture. lastGesture = this . gesture ; this . gesture = this . determineGesture ( ) ; // Same gesture. if ( this . gesture === lastGesture ) { return ; } // Animate gesture. this . animateGesture ( this . gesture , lastGesture ) ; // Emit events. this . emitGestureEvents ( this . gesture , lastGesture ) ; }
Play model animation, based on which button was pressed and which kind of event.

1. Process buttons.
2. Determine gesture (this.determineGesture()).
3. Animation gesture (this.animationGesture()).
4. Emit gesture events (this.emitGestureEvents()).

@param {string} button - Name of the button.
@param {string} evt - Type of event for the button (i.e., down/up/touchstart/touchend).
Play model animation based on which button was pressed and which kind of event .