Handles piped in touch events. Emits 'start', 'update', and 'events' events with delta, position, velocity, acceleration, clientX, clientY, count, and touch id. Useful for dealing with inputs on touch devices. Designed to be used either as standalone, or included in a GenericSync.
Number of previous frames to check velocity against.
scale
Number
constant factor to scale velocity output
touchLimit
Number
touchLimit upper bound for emitting events based on number of touches
Methods
_handleStart()Private
Triggered by trackstart.
_handleMove()Private
Triggered by trackmove.
_handleEnd()Private
Triggered by trackend.
setOptions(options)
Set internal options, overriding any default options
Parameters
options
Object
default options overrides
getOptions()
Return entire options dictionary, including defaults.
Returns
Object
configuration options
Example
var Surface = require('../core/Surface');
var TouchSync = require('../inputs/TouchSync');
var surface = new Surface({ size: [100, 100] });
var touchSync = new TouchSync();
surface.pipe(touchSync);
touchSync.on('start', function(e){ // react to start });
touchSync.on('update', function(e){ // react to update });
touchSync.on('end', function(e){ // react to end });*