title: Moving markers in Google Maps API v3 without being so processor intensive?
body: <p>I'm trying to move a marker on a GoogleMap to simulate real time object movements. At present the JavaScript pseudo code for how I do this is:</p>
  
  <pre><code>var marker = new google.maps.Marker({
      position: myLatlng, 
      map: map
  });
  
  var myMovementArray[] = new movementArray(startPoint, endPoint);
  
  drawMovement(int pos){
      marker.setPosition(myMovementArray[pos]["lat"], myMovementArray[pos]["lng"]);
      pos++;
      if (pos &lt; myMovementArray.length()){
          setTimeout('drawMovement('+pos+')', 33);
      }
  }
  
  init(){
      drawMovement(0);
  }
  </code></pre>
  
  <p>Where each element in the movement array is calculated through:</p>
  
  <pre><code>deltaLat = (endPos.lat - startPos.lat)/frames;
  deltaLng = (endPos.lng - startPos.lng)/frames;
  myMovementArray[i]["lat"] = startPos.lat + (deltaLat * i);
  myMovementArray[i]["lng"] = startPos.lng + (deltaLng * i);
  </code></pre>
  
  <p>For reference, the full JavaScript file I am using is up at:
  <a href="http://spad.es/js/com.kamkash.locateme.viewer.dev.js" rel="nofollow">http://spad.es/js/com.kamkash.locateme.viewer.dev.js</a></p>
  
  <p>The problem I have is that this method of moving markers on Google maps seems to be quite processor intensive. I've searched around to see if the Google Maps API has a clean way of animating marker movement from point A to point B, but can't find anything. And the other most referenced method for doing this that I've found is exemplified at <a href="http://www.geocodezip.com/v3_animate_marker_directions.html" rel="nofollow">http://www.geocodezip.com/v3_animate_marker_directions.html</a> but then that uses the same method I have deployed.</p>
  
  <p>The code is used in practice at:
  www.spad.es/random</p>
  
  <p>Does anybody have a more processor-efficient/cleaner way of doing this?</p>
  
  <p>Thanks</p>