Skip to content

adireddy/haxe-hammer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

haxe-hammer

Externs of HAMMER.JS for Haxe - Javascript touch gestures library.

Installation

haxelib install hammerjs

Demo

http://adireddy.github.io/demos/haxe-hammer

Usage

import hammer.Hammer;
import hammer.Manager;
import hammer.recognizers.Rotate;
import hammer.GestureInteractionData;
import js.Browser;
import js.html.HtmlElement;

class Main {

	public function new() {
		// get a reference to an element
		var stage:HtmlElement = cast Browser.document.getElementById("stage");

		// create a manager for that element
		var mc:Manager = new Manager(stage);

		// create a recognizer
		var rotate = new Rotate();

		// add the recognizer
		mc.add(rotate);

		// subscribe to events
		mc.on("rotate", function(e:GestureInteractionData) {
		    // do something cool
		    var rotation = Math.round(e.rotation);
		    stage.style.transform = "rotate(" + rotation + "deg)";
		});
	}
}

This content is released under the MIT License.

hammer.js is written by Jorik Tangelder (Eight Media) and licensed under the MIT License.

About

Externs of hammer.js for Haxe

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published