Show:
Extends Inputs._TwoFingerInput

Detects two-finger pinching motion and emits start, update and end events with the payload data:

 value         - Distance between the two touches
 delta         - Differential in successive distances
 velocity      - Relative velocity between two touches
 displacement  - Total accumulated displacement
 center        - Midpoint between the two touches

Constructor

Inputs.PinchInput

(
  • options
)

Parameters:

  • options Object

    Options

    • [scale=1] Number optional

      Scale the response to pinch

    • [direction] Number optional

      Direction to project movement onto. Options found in TouchInput.DIRECTION.

    • [rails=false] Boolean optional

      If a direction is specified, movement in the orthogonal direction is suppressed

Example:

 var pinchInput = new PinchInput();
        
         pinchInput.subscribe(Engine) // listens on window events
        
         pinchInput.on('start', function(payload){
             console.log('start', payload);
         });
        
         pinchInput.on('update', function(payload){
             console.log('update', payload);
         });
        
         pinchInput.on('end', function(payload){
             console.log('end', payload);
         });

Item Index