Augmented
Web Gestures
Web Gestures
a tQuery way
to interact with your Browser
Jerome Etienne
Jerome Etienne
var aGesture = new tQuery.AugmentedGesture();
// get debug texture var texture = aJoystick.texture(); // put the debug texture on top on the screen var domElement = texture.image; document.body.appendChild(domElement);
aGesture.bind('update', function(pointerR, pointerL){
console.log(pointerR, pointerL);
});
var gestureR = new tQuery.GestureRecognition();
aGesture.bind('update', function(pointerR, pointerL){
var eventR = gestureR.update(pointerR.x, pointerR.y, canvasW, canvasH);
// eventR === null if nothing recognize
// eventR === 'punch' if a punch if recognize
});
var character = new tQuery.RatamahattaMD2Character(); character.attach(world);
if( eventR === 'punch' ){
character.animation('crdeath'); // make character move
// play a sound
tQuery.createSound().load('eatghost.mp3', function(sound){
sound.play();
});
// change the weapon
character.setWeapon(Math.floor(Math.random()*11 % 11));
}
Jerome Etienne