title: Rotate arrow on hover over to land at certain degree and load image
body: <p>I'm looking for someone to help guide me in the right direction for a function I'm trying to create.</p>
  
  <p>I need to create an arrow that when at a certain point of degree, a tree grows, I have created 7 different heights and 7 different images for the tree's for a clean look.</p>
  
  <p>Basically you know how you can have an image and rotate it using </p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  var img = $('.image');
  if(img.length &gt; 0){
  var offset = img.offset();
  function mouse(evt){
      var center_x = (offset.left) + (img.width()/2);
      var center_y = (offset.top) + (img.height()/2);
      var mouse_x = evt.pageX; var mouse_y = evt.pageY;
      var radians = Math.atan2(mouse_x - center_x, mouse_y - center_y);
      var degree = (radians * (180 / Math.PI) * -1) + 90; 
      img.css('-moz-transform', 'rotate('+degree+'deg)');
      img.css('-webkit-transform', 'rotate('+degree+'deg)');
      img.css('-o-transform', 'rotate('+degree+'deg)');
      img.css('-ms-transform', 'rotate('+degree+'deg)');
  }
  $(document).mousemove(mouse);
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>But how do I get my arrow to stop at 20 degree's, 25 degree's, 30 degree's etc etc.. while at the same time loading the new image i have assigned to that certain degree (whatever the tip of the arrow is pointed at) all doing this by hover over.</p>
  
  <p>And not only do stop and load the new image, but also once the user clicks submit it adds data to my tree table within my db. So basically, its an arrow, the tip of the arrow gets set at a certain degree, loads the new image, takes the height of the image (i need some way of assigning the height var to each individual image im guessing?) then query that into my tree table under the tree height field.</p>
  
  <p>Any help, links to get me started would be greatly appreciated.</p>
  
  <p>Also, is there a way to do this with Canvas or SVG? Instead of using a arrow image as my arrow? For a more clean look.</p>