Advertisement
TrinkerMedia

TUIO - Rotate #div

Jun 26th, 2014
594
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. if (x){
  2.    
  3.     //Define rotation
  4.     var rotated = false;
  5.     var div = document.getElementById('div'),
  6.         // data.angle is provided by TUIO
  7.         // data.angle - external source number with value from 0 - 7
  8.         // assuming that 360˚ = 7 for full rotation
  9.         // and 0˚ = 0 start of rotation
  10.         deg = rotated ? 0 : (data.angle * 57);
  11.  
  12.         div.style.webkitTransform = 'rotate('+deg+'deg)';
  13.         div.style.mozTransform    = 'rotate('+deg+'deg)';
  14.         div.style.msTransform     = 'rotate('+deg+'deg)';
  15.         div.style.oTransform      = 'rotate('+deg+'deg)';
  16.         div.style.transform       = 'rotate('+deg+'deg)';
  17.    
  18.        rotated = !rotated;
  19.                    
  20.     console.log(deg + "......." + data.angle);
  21.                                                
  22. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement