CameraAnimationsPluginImpl

CameraAnimationsPluginImpl is designed to rule all the animations happening to the map driven by changing CameraOptions. It is responsible for:

  • Storing all the ValueAnimator's that could be run. Only specific camera animators could be used in this plugin.

  • Controlling animation execution - only one ValueAnimator of certain type could be run at a time. If some another animation with same CameraAnimator.type is about to start previous one will be cancelled.

  • Giving possibility to listen to CameraOptions values changes during animations via listeners.

  • If several animations of different CameraAnimator.type are running simultaneously map camera will be updated only on oldest animation update (the oldest is the one that was started first). That actually means that animation start order matters. High-level animations flyTo and easeTo will always trigger camera center animator first.

CameraAnimationsPluginImpl is NOT thread-safe meaning all animations must be started from one thread. However, it doesn't have to be the UI thread.

class CameraAnimationsPluginImpl : CameraAnimationsPlugin

Constructors

CameraAnimationsPluginImpl
Link copied to clipboard
fun CameraAnimationsPluginImpl()

Types

Companion
Link copied to clipboard

Static variables and methods.

object Companion

Functions

addCameraAnchorChangeListener
Link copied to clipboard

Add CameraAnimatorNullableChangeListener to receive map anchor updates.

open override fun addCameraAnchorChangeListener(listener: CameraAnimatorNullableChangeListener<ScreenCoordinate?>)
addCameraAnimationsLifecycleListener
Link copied to clipboard

Add given CameraAnimationsLifecycleListener for capturing all events about animators lifecycle.

open override fun addCameraAnimationsLifecycleListener(listener: CameraAnimationsLifecycleListener)
addCameraBearingChangeListener
Link copied to clipboard

Add CameraAnimatorChangeListener to receive map bearing updates.

open override fun addCameraBearingChangeListener(listener: CameraAnimatorChangeListener<Double>)
addCameraCenterChangeListener
Link copied to clipboard

Add CameraAnimatorChangeListener to receive map center updates.

open override fun addCameraCenterChangeListener(listener: CameraAnimatorChangeListener<Point>)
addCameraPaddingChangeListener
Link copied to clipboard

Add CameraAnimatorChangeListener to receive map padding updates.

open override fun addCameraPaddingChangeListener(listener: CameraAnimatorChangeListener<EdgeInsets>)
addCameraPitchChangeListener
Link copied to clipboard

Add CameraAnimatorChangeListener to receive map pitch updates.

open override fun addCameraPitchChangeListener(listener: CameraAnimatorChangeListener<Double>)
addCameraZoomChangeListener
Link copied to clipboard

Add CameraAnimatorChangeListener to receive map zoom updates.

open override fun addCameraZoomChangeListener(listener: CameraAnimatorChangeListener<Double>)
calculateScaleBy
Link copied to clipboard

Calculate target zoom by applying scale

open override fun calculateScaleBy(amount: Double, currentZoom: Double): Double
cancelAllAnimators
Link copied to clipboard

Cancel all animators except ones owned by exceptOwnerList list.

open override fun cancelAllAnimators(exceptOwnerList: List<String>)
cleanup
Link copied to clipboard

Called when the map is destroyed. Should be used to cleanup plugin resources for that map. Cancel all running animations and cleanup all resources (registered animations, listeners).

open override fun cleanup()
createAnchorAnimator
Link copied to clipboard

Create CameraAnchorAnimator

open override fun createAnchorAnimator(options: CameraAnimatorOptions<ScreenCoordinate>, block: ValueAnimator.() -> Unit?): ValueAnimator
createBearingAnimator
Link copied to clipboard

Create CameraBearingAnimator. Current map camera option will be applied on animation start if not specified explicitly with options.startValue.

open override fun createBearingAnimator(options: CameraAnimatorOptions<Double>, useShortestPath: Boolean, block: ValueAnimator.() -> Unit?): ValueAnimator
createCenterAnimator
Link copied to clipboard

Create CameraCenterAnimator. Current map camera option will be applied on animation start if not specified explicitly with options.startValue.

open override fun createCenterAnimator(options: CameraAnimatorOptions<Point>, block: ValueAnimator.() -> Unit?): ValueAnimator
createPaddingAnimator
Link copied to clipboard

Create CameraPaddingAnimator. Current map camera option will be applied on animation start if not specified explicitly with options.startValue.

open override fun createPaddingAnimator(options: CameraAnimatorOptions<EdgeInsets>, block: ValueAnimator.() -> Unit?): ValueAnimator
createPitchAnimator
Link copied to clipboard

Create CameraPitchAnimator. Current map camera option will be applied on animation start if not specified explicitly with options.startValue.

open override fun createPitchAnimator(options: CameraAnimatorOptions<Double>, block: ValueAnimator.() -> Unit?): ValueAnimator
createZoomAnimator
Link copied to clipboard

Create CameraZoomAnimator

open override fun createZoomAnimator(options: CameraAnimatorOptions<Double>, block: ValueAnimator.() -> Unit?): ValueAnimator
easeTo
Link copied to clipboard

Ease the map camera to a given camera options and animation options.

open override fun easeTo(cameraOptions: CameraOptions, animationOptions: MapAnimationOptions?): Cancelable
equals
Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
flyTo
Link copied to clipboard

Fly the map camera to a given camera options.

This method implements an “optimal path” animation, as detailed in: Van Wijk, Jarke J.; Nuij, Wim A. A. “Smooth and efficient zooming and panning.” INFOVIS ’03. pp. 15–22. The online documentation. Where applicable, local variable documentation begins with the associated variable or function in van Wijk (2003).

open override fun flyTo(cameraOptions: CameraOptions, animationOptions: MapAnimationOptions?): Cancelable
hashCode
Link copied to clipboard
open override fun hashCode(): Int
initialize
Link copied to clipboard
open override fun initialize()
moveBy
Link copied to clipboard

Move the map by a given screen coordinate with optional animation.

open override fun moveBy(screenCoordinate: ScreenCoordinate, animationOptions: MapAnimationOptions?): Cancelable
onDelegateProvider
Link copied to clipboard

Provides all map delegate instances.

open override fun onDelegateProvider(delegateProvider: MapDelegateProvider)
pitchBy
Link copied to clipboard

Pitch the map by with optional animation.

open override fun pitchBy(pitch: Double, animationOptions: MapAnimationOptions?): Cancelable
playAnimatorsSequentially
Link copied to clipboard

Play given ValueAnimator's sequentially

open override fun playAnimatorsSequentially(vararg animators: Array<out ValueAnimator>)
playAnimatorsTogether
Link copied to clipboard

Play given ValueAnimator's together

open override fun playAnimatorsTogether(vararg animators: Array<out ValueAnimator>)
registerAnimators
Link copied to clipboard

Register given ValueAnimator's. Such ValueAnimator's must be created with static methods like CameraAnimationsPlugin.createCenterAnimator or similar. Only registered animations affect MapboxMap and would not even start otherwise.

open override fun registerAnimators(vararg cameraAnimators: Array<out ValueAnimator>)
removeCameraAnchorChangeListener
Link copied to clipboard

Remove CameraAnimatorNullableChangeListener. No updates will arrive after that.

open override fun removeCameraAnchorChangeListener(listener: CameraAnimatorNullableChangeListener<ScreenCoordinate?>)
removeCameraAnimationsLifecycleListener
Link copied to clipboard

Remove given CameraAnimationsLifecycleListener for capturing all events about animators lifecycle.

open override fun removeCameraAnimationsLifecycleListener(listener: CameraAnimationsLifecycleListener)
removeCameraBearingChangeListener
Link copied to clipboard

Remove CameraAnimatorChangeListener. No updates will arrive after that.

open override fun removeCameraBearingChangeListener(listener: CameraAnimatorChangeListener<Double>)
removeCameraCenterChangeListener
Link copied to clipboard

Remove CameraAnimatorChangeListener. No updates will arrive after that.

open override fun removeCameraCenterChangeListener(listener: CameraAnimatorChangeListener<Point>)
removeCameraPaddingChangeListener
Link copied to clipboard

Remove CameraAnimatorChangeListener. No updates will arrive after that.

open override fun removeCameraPaddingChangeListener(listener: CameraAnimatorChangeListener<EdgeInsets>)
removeCameraPitchChangeListener
Link copied to clipboard

Remove CameraAnimatorChangeListener. No updates will arrive after that.

open override fun removeCameraPitchChangeListener(listener: CameraAnimatorChangeListener<Double>)
removeCameraZoomChangeListener
Link copied to clipboard

Remove CameraAnimatorChangeListener. No updates will arrive after that.

open override fun removeCameraZoomChangeListener(listener: CameraAnimatorChangeListener<Double>)
rotateBy
Link copied to clipboard

Rotate the map by with optional animation.

open override fun rotateBy(first: ScreenCoordinate, second: ScreenCoordinate, animationOptions: MapAnimationOptions?): Cancelable
scaleBy
Link copied to clipboard

Scale the map by with optional animation.

open override fun scaleBy(amount: Double, screenCoordinate: ScreenCoordinate?, animationOptions: MapAnimationOptions?): Cancelable
toString
Link copied to clipboard
open override fun toString(): String
unregisterAllAnimators
Link copied to clipboard

Unregister all previously registered ValueAnimator's.

fun unregisterAllAnimators()
unregisterAnimators
Link copied to clipboard

Unregister given ValueAnimator's.

open override fun unregisterAnimators(vararg cameraAnimators: Array<out ValueAnimator>, cancelAnimators: Boolean)

Properties

anchor
Link copied to clipboard

Map camera anchor value. Default value is NULL meaning center of given map view. Left-top corner is represented as ScreenCoordinate (0.0, 0.0).

If anchor is set to some specific value (set directly or by some running anchor animation) it will be used as anchor for all upcoming animations even if they do not animate anchor directly.

Note: If anchor animator is started and no start value is specified explicitly and anchor = NULL - then start value will be set to ScreenCoordinate(0.0, 0.0) automatically and it will be start point for interpolation.

open override var anchor: ScreenCoordinate?
cameraAnimationsFactory
Link copied to clipboard

Factory to provide animators for the default animations like easeTo, scaleBy, moveBy, rotateBy, pitchBy

lateinit var cameraAnimationsFactory: CameraAnimatorsFactory
debugMode
Link copied to clipboard

If debug mode is enabled extra logs will be written about animation lifecycle and some other events that may be useful for debugging.

open override var debugMode: Boolean