title: Move Google Map Marker from 1 location to another smoothly
body: <p>I am using this Script to move the Google Map marker from 1 place to another
  source
  <a href="https://stackoverflow.com/questions/5892113/extend-google-maps-marker-to-animate-smoothly-on-update">Extend Google Maps marker to animate smoothly on update?</a> </p>
  
  <p>As per my logic here the Difference between the Previous &amp; the Current Location is calculated &amp; divided by a number (eg 100) &amp; adding the result to the Previous Location for 100 times to reach the Current Location. </p>
  
  <p>But when I change the Value of steps (Num Deltas) as given below from 100 to any other Number for Eg 4  &amp; make the Loop run 4 times the Location of the Marker after that is different from the Current Location. 
  Can any one plaese suggest me the Importance of using the No. of Steps (Num Deltas) as 100 &amp; not any other Number`</p>
  
  <pre><code>var latlng = new google.maps.LatLng(position[0], position[1]);
  var myOptions = {
      zoom: 8,
      center: latlng,
      mapTypeId: google.maps.MapTypeId.ROADMAP
  };
  map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
  
  marker = new google.maps.Marker({
      position: latlng,
      map: map,
      title: "Your current location!"
  });
  
  google.maps.event.addListener(map, 'click', function(me) {
      var result = [me.latLng.lat(), me.latLng.lng()];
      transition(result);
  });
  }
  
  var numDeltas = 100;
  var delay = 10; //milliseconds
  var i = 0;
  var deltaLat;
  var deltaLng;
  function transition(result){
  i = 0;
  deltaLat = (result[0] - position[0])/numDeltas;
  deltaLng = (result[1] - position[1])/numDeltas;
  moveMarker();
  }
  
   function moveMarker(){
  position[0] += deltaLat;
  position[1] += deltaLng;
  var latlng = new google.maps.LatLng(position[0], position[1]);
  marker.setPosition(latlng);
  if(i!=numDeltas){
      i++;
      setTimeout(moveMarker, delay);
  }
  }
  </code></pre>
  
  <p>Here is a jsFiddle of the code working: <a href="http://jsfiddle.net/rcravens/RFHKd/13/" rel="nofollow noreferrer">http://jsfiddle.net/rcravens/RFHKd/13/</a></p>