set Max Animation Fps
Set max FPS at which location animators can output updates. The throttling will only impact the location puck and camera tracking smooth animations.
Setting this will not impact any other animations schedule with MapLibreMap, gesture animations or zoomWhileTracking/tiltWhileTracking.
Use this setting to limit animation rate of the location puck on higher zoom levels to decrease the stress on the device's CPU which can directly improve battery life, without sacrificing UX.
Example usage:
MapLibreMap.addOnCameraIdleListener(new MapLibreMap.OnCameraIdleListener() {
{@}Override
public void onCameraIdle() {
double zoom = MapLibreMap.getCameraPosition().zoom;
int maxAnimationFps;
if (zoom < 5) {
maxAnimationFps = 3;
} else if (zoom < 10) {
maxAnimationFps = 5;
} else if (zoom < 15) {
maxAnimationFps = 7;
} else if (zoom < 18) {
maxAnimationFps = 15;
} else {
maxAnimationFps = Integer.MAX_VALUE;
}
locationComponent.setMaxAnimationFps(maxAnimationFps);
}
});
Content copied to clipboard
If you're looking for a way to throttle the FPS of the whole map, including other animations and gestures, see setMaximumFps.
Parameters
max Animation Fps
max location animation FPS