gesture-component

Higher level gesture API built on hammer.js

Gesture

Emitter wrapper and a little sugar on top of Hammer.js.

$ component install component/gesture
  • drag start
  • drag
  • drag end
  • tap
  • double tap
  • hold
  • release
  • transform start
  • transform
  • transform end
  • swipe
  • swipe left
  • swipe right
  • swipe up
  • swipe down

Bind gestures to the given el.

var gesture = require('gesture');
var img = document.getElementById('maru');
 
gesture(img)
.on('transform', function(e){
  var r = e.rotation.toFixed(2);
  var s = e.scale.toFixed(2);
  img.style['-webkit-transform'] = 'rotate(' + r + 'deg) scale(' + s + ')';
});

MIT