Receiver.onTouchMove( callback )

Use this method to pass a function to a receiver, which should be called while the controlling user touches her screen. 
 

Callback arguments

  • object data

    • string direction
      Indicates the part of the screen the user is touching
      left, right, up or down

    • number x
      Indicates the x-position of the touch relative to the screen
      Ranges from -0.5 to 0.5

    • number y 
      Indicates the y-position of the touch relative to the screen
      Ranges from -0.5 to 0.5

    • number angle
      Indicates the angle (in radians) of the touch in respect to the center of the screen

    • number length
      Indicates the distance between the touch point and the center of the screen

 

Example

In the following example, a developer is creating a drawing app. When a user touches the screen of his smartphone, a brush will start drawing on a large screen outside in a park. 

var currentCoordinates = { "x" : 0.5, "y" : 0.5 };

var drawer = PLUGPIN.createReceiver();

drawer.onTouchMove( function( data )
{
    var newCoordinates = { "x" : data.x, "y" : data.y };
    drawLine( currentCoordinates, newCoordinates );
    currentCoordinates = newCoordinates;
} );

 

Contact us


Talk to us!
Tell us anything you want to and please add your contact information.




Our contact info
tel. +31 (0) 20 2170013
info@plugpin.com

Groenhoedenveem 28
1019 BL Amsterdam
The Netherlands

News letter


Enter your e-mail address to stay informed on everything PlugPIN!