SHARE
TWEET

Untitled

a guest Nov 20th, 2019 83 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. document.body.innerHTML = '<div id="m" style="width:100px;height:5px;background:black;"></div>';
  2. px = 0;
  3. py = 0;
  4. angleDeg = (x1,y1,x2,y2) => Math.atan2(y2 - y1, x2 - x1) * 180 / Math.PI;
  5. document.onmousemove = function(e) {
  6.     document.querySelector('#m').style.transform = 'rotate(' + angleDeg(px, py, e.x, e.y) + 'deg)';
  7. px = e.x; py = e.y;
  8.  
  9. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top