mapbox-maps-android icon indicating copy to clipboard operation
mapbox-maps-android copied to clipboard

Animation: add flag for camera to disable setCamera optimisation

Open kiryldz opened this issue 4 years ago • 0 comments

New Feature

Currently camera plugin will always use optimisation to group different animator type camera animators in order to call mapboxMap.setCamera(camera) only for the oldest animator. That actually forces user to start animators in strict order proceed with correct updates (more context here).

We could bring in API to disable that optimisation (by default it will be enabled meaning it will work as it works now).

/**
 If turned on `setCamera` will be called only once during update of first started animation when multiple animations run at the same time. This reduces JNI calls and performing some calculations in core reducing CPU utilisation.
 */
CameraAnimationPlugin.optimizeCameraUpdates(enabled: Boolean)

Why

As part of this task we could also validate how much resources do we save by having this optimisation on. For some use-cases it will be easier to disable this optimisation and do not worry about order of staring animators.

kiryldz avatar May 24 '21 16:05 kiryldz