public/assets/phantom-limb.js
function moveFingers(e) {
    // We'll use this if the second is locked with the first.
    var changeX = e.clientX - fingers[0].x || 0;
    var changeY = e.clientY - fingers[0].y || 0;

    // The first finger just follows the mouse.
    fingers[0].move(e.clientX, e.clientY);

    // TODO: Determine modifier keys independent of mouse movement.

    if (e.altKey) {
      // Reset the center.
      if (!centerX && !centerY) {
        centerX = innerWidth / 2;
        centerY = innerHeight / 2;
      }

      // Lock the center with the first finger.
      if (e.shiftKey) {
        centerX += changeX;
        centerY += changeY;
      }

      var secondX = centerX + (centerX - e.clientX);
      var secondY = centerY + (centerY - e.clientY);

      fingers[1].move(secondX, secondY);
    } else {
      // Disengage the second finger.
      fingers[1].move(NaN, NaN);

      // Reset the center next time the alt key is held.
      centerX = NaN;
      centerY = NaN;
    }
  }
function moveFingers(e) {
    // We'll use this if the second is locked with the first.
    var changeX = e.clientX - fingers[0].x || 0;
    var changeY = e.clientY - fingers[0].y || 0;

    // The first finger just follows the mouse.
    fingers[0].move(e.clientX, e.clientY);

    // TODO: Determine modifier keys independent of mouse movement.

    if (e.altKey) {
      // Reset the center.
      if (!centerX && !centerY) {
        centerX = innerWidth / 2;
        centerY = innerHeight / 2;
      }

      // Lock the center with the first finger.
      if (e.shiftKey) {
        centerX += changeX;
        centerY += changeY;
      }

      var secondX = centerX + (centerX - e.clientX);
      var secondY = centerY + (centerY - e.clientY);

      fingers[1].move(secondX, secondY);
    } else {
      // Disengage the second finger.
      fingers[1].move(NaN, NaN);

      // Reset the center next time the alt key is held.
      centerX = NaN;
      centerY = NaN;
    }
  }
function moveFingers ( e ) { // We'll use this if the second is locked with the first. var changeX = e . clientX - fingers [ 0 ] . x || 0 ; var changeY = e . clientY - fingers [ 0 ] . y || 0 ; // The first finger just follows the mouse. fingers [ 0 ] . move ( e . clientX , e . clientY ) ; // TODO: Determine modifier keys independent of mouse movement. if ( e . altKey ) { // Reset the center. if ( ! centerX && ! centerY ) { centerX = innerWidth / 2 ; centerY = innerHeight / 2 ; } // Lock the center with the first finger. if ( e . shiftKey ) { centerX += changeX ; centerY += changeY ; } var secondX = centerX + ( centerX - e . clientX ) ; var secondY = centerY + ( centerY - e . clientY ) ; fingers [ 1 ] . move ( secondX , secondY ) ; } else { // Disengage the second finger. fingers [ 1 ] . move ( NaN , NaN ) ; // Reset the center next time the alt key is held. centerX = NaN ; centerY = NaN ; } }
Set each finger's position target. Pressing alt engages the second finger. Pressing shift locks the second finger's position relative to the first's.
Set each finger s position target . Pressing alt engages the second finger . Pressing shift locks the second finger s position relative to the first s .