Nel precedente tutorial vi abbiamo mostrato come effettuare un Drag and Drop degli elementi presenti sulla vostra pagina web, oggi vi mostreremo come efettuare un resize e una rotazione in modo da avere il pieno controllo sul vostro oggetto.
var width = 100, height = 200, rotation = ;
node.ongesturechange = function(e){
var node = e.target;
// scale and rotation are relative values,
// so we wait to change our variables until the gesture ends
node.style.width = (width * e.scale) + "px";
node.style.height = (height * e.scale) + "px";
node.style.webkitTransform = "rotate(" + ((rotation + e.rotation) % 360) + "deg)";
}
node.ongestureend = function(e){
// Update the values for the next time a gesture happens
width *= e.scale;
height *= e.scale;
rotation = (rotation + e.rotation) % 360;
}
fonte: www.sastgroup.com » Vai al post originale






