<img id="img" src="https://upload.wikimedia.org/wikipedia/commons/thumb/7/71/Arrow_east.svg/2560px-Arrow_east.svg.png">
#img{
width:100px;
margin:100px;
}
var img = document.all.img;
document.onmousemove = function(e){
var d1 = {x:e.offsetX,y:e.offsetY};
var d2 = {x:img.offsetLeft,y:img.offsetTop};
img.style.transform =`rotate(${Math.atan2(d1.y - d2.y, d1.x - d2.x) }rad)`;
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.