Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Well, I hope somebody provide a better answer, but with the many experiments I've done, I was unable to get a decent smooth scroll using animateCamera.</p> <p>Regardless of only changing Lat/Lng for points close together, the cameraman kept making impressive takeoffs and landings.</p> <p>I have had limited 'el-cheapo' animation success with the following routine:</p> <pre><code> private void animateTo(double lat, double lon, double zoom, double bearing, double tilt, final int milliseconds) { if (mMapInstance==null) return; mMapInstance.setMapType(paramMapMode); mCurrentPosition=new LatLng(lat,lon); // animate camera jumps too much // so we set the camera instantly to the next point mMapInstance.moveCamera(CameraUpdateFactory.newCameraPosition(new CameraPosition(mCurrentPosition,(float)zoom, (float)tilt, (float)bearing))); // give Android a break so it can load tiles. If I start the animation // without pause, no tile loading is done mMap.postDelayed(new Runnable(){ @Override public void run() { // keeping numbers small you get a nice scrolling effect mMapInstance.animateCamera(CameraUpdateFactory.scrollBy(250-(float)Math.random()*500-250, 250-(float)Math.random()*500),milliseconds,null); }},500); } </code></pre> <p>This routine, called with milliseconds value in the 10000s, goes to one point then makes a flyover animation in a random direction keeping the damn zoom tranquilo. As the pixel values are very small, chances are it's everything cached.</p> <p>Anybody with a better solution? Is it reasonable or possible to try to inject touch events to simulate a 'touched' fling?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload