Hello,
I used the service to route between two or more places with the method of 
animation. The points are many and are added from time to time with the 
time. I made sure that the zoom of the map is not suitable route but it is 
free.
Now I noticed that when the points are more than twenty map starts to slow 
down and it becomes unwieldy with zoom and center. You can do so that you 
can avoid the slowdown, and it is always possible to manage it?

The code used:

function animate() {

    if (d > eol) {
        marker.setPosition(endLocation.latlng);
        cancelAnimationFrame(timerHandle);
        return;
    }
    var p = polyline.GetPointAtDistance(d);
    marker.setPosition(p);
    if (preP != 0) {
        var flightPlanCoordinates = [
          new google.maps.LatLng(preP.jb, preP.kb),
          new google.maps.LatLng(p.jb, p.kb)
        ];
        var flightPath = new google.maps.Polyline({
            path: flightPlanCoordinates,
            strokeColor: '#e40521',
            strokeOpacity: 0.0,
            strokeWeight: 3,
            zIndex: 200
        });
        flightPath.setMap(map);
    } 
    preP = p;
    updatePoly(d);
    d = d + step;
    //timerHandle = setTimeout("animate(" + (d + step) + ")", tick);
    timerHandle = window.requestAFrame(animate)
}

window.requestAFrame = (function () {
    return window.requestAnimationFrame ||
            window.webkitRequestAnimationFrame ||
            window.mozRequestAnimationFrame ||
            window.oRequestAnimationFrame ||
            window.msRequestAnimationFrame ||
            // if all else fails, use setTimeout
            function (callback) {
                return window.setTimeout(callback, tick); // shoot for 60 
fps
            };
})();

var cancelAnimationFrame = window.cancelAnimationFrame || 
window.mozCancelAnimationFrame || window.webkitCancelAnimationFrame ||
                            window.oCancelAnimationFrame || 
window.msCancelAnimationFrame || window.CancelRequestAnimationFrame ||
                             window.mozCancelRequestAnimationFrame || 
window.webkitCancelRequestAnimationFrame ||
                             window.oCancelRequestAnimationFrame || 
window.msCancelRequestAnimationFrame ||
            // if all else fails, use setTimeout
            function (callback) {
                return clearTimeout(callback); 
            };


Thank you,
dave

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-maps-js-api-v3+unsubscr...@googlegroups.com.
To post to this group, send email to google-maps-js-api-v3@googlegroups.com.
Visit this group at http://groups.google.com/group/google-maps-js-api-v3.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to