pixi-simple-gesture
Add Pinch, Pan, Tap gesture support to pixi.js sprites.
npm install --save pixi-simple-gesture
Usage
Pinch
var gesture = var sprite = texturegesture sprite sprite sprite
The 'pinchmove' handler receives an event object containing the following properties.
Name | Value |
---|---|
scale | Scaling that has been done |
velocity | Velocity in px/ms |
center | Center position for multi-touch |
data | Original InteractionData from pixi.js |
Pan
var gesture = var sprite = texturegesture sprite sprite sprite
The 'panmove' handler receives an event object containing the following properties.
Name | Value |
---|---|
deltaX | Movement of the X axis |
deltaY | Movement of the Y axis |
velocity | Velocity in px/ms |
data | Original InteractionData from pixi.js |
Tap
var gesture = var sprite = texturegesture sprite
NOT 'tap', simpletap. Because 'tap' is already used by pixi.js. This 'simpletap' works a bit better with 'pinch' and 'pan'. The Handler receives an event object containing the following properties.
Name | Value |
---|---|
data | Original InteractionData from pixi.js |
Note
Any requests, issues, PRs are welcome!
TODO
- Add Inertia Mode
- Add Complex? Tap, emits 'tapstart', 'tapcancel', 'tapend'. Could be useful to implement UI components which has active state style.