> For the complete documentation index, see [llms.txt](https://docs.mapbox.com/android/maps/llms.txt)

# Continue camera animation during gestures

![Animate the map camera properties during user gestures.](https://docs.mapbox.com/android/assets/ideal-img/maps-examples-continue-camera-animation-during-gestures.00e2cdc.480.png)

This example demonstrates how to animate the [pitch](https://docs.mapbox.com/help/glossary/camera/#pitch) of the map using the **Mapbox Maps SDK for Android**.

The code below applies an animation to the `MapView` by adjusting [`CameraAnimatorOptions`](https://docs.mapbox.com/android/maps/api/latest/mapbox-maps-android/com.mapbox.maps.plugin.animation/-camera-animator-options/?query=class%20CameraAnimatorOptions%3CT%3E) for example the start and end pitch values, animation duration, and interpolation. The animation repeats continuously, pausing for a second and then repeating. The animation continues to occur, even when a user gesture is activated due to the [`addProtectedAnimationOwner()`](https://docs.mapbox.com/android/maps/api/latest/mapbox-maps-android/com.mapbox.maps.plugin.gestures/-gestures-plugin/add-protected-animation-owner.html?query=abstract%20fun%20addProtectedAnimationOwner(owner:%20String)) function.

> **Note: Android Examples App Available**
> 
> This example code is part of the **Maps SDK for Android Examples App**, a working Android project [available on GitHub](https://github.com/mapbox/mapbox-maps-android/tree/v11.31.0/). Android developers are encouraged to run the examples app locally to interact with this example in an emulator and explore other features of the Maps SDK.
> 
> See our [Run the Maps SDK for Android Examples App](https://docs.mapbox.com/help/tutorials/maps-sdk-android-examples-app/) tutorial for step-by-step instructions.

**Kotlin**

Title: `OngoingAnimationActivity.kt`

[View on GitHub](https://github.com/mapbox/mapbox-maps-android/blob/v11.31.0/app/src/main/java/com/mapbox/maps/testapp/examples/OngoingAnimationActivity.kt)

```kt
package com.mapbox.maps.testapp.examples

import android.animation.ValueAnimator
import android.os.Bundle
import android.view.animation.LinearInterpolator
import androidx.appcompat.app.AppCompatActivity
import com.mapbox.geojson.Point
import com.mapbox.maps.CameraOptions
import com.mapbox.maps.MapView
import com.mapbox.maps.plugin.animation.CameraAnimatorOptions
import com.mapbox.maps.plugin.animation.camera
import com.mapbox.maps.plugin.gestures.gestures
import java.util.concurrent.TimeUnit

class OngoingAnimationActivity : AppCompatActivity() {

  override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    val mapView = MapView(this)
    setContentView(mapView)
    mapView.mapboxMap
      .apply {
        setCamera(
          CameraOptions.Builder()
            .center(Point.fromLngLat(LONGITUDE, LATITUDE))
            .zoom(9.0)
            .build()
        )
      }

    mapView.gestures.addProtectedAnimationOwner(OWNER)

    val anim = mapView.camera.createPitchAnimator(
      CameraAnimatorOptions.cameraAnimatorOptions(0.0, 30.0) {
        owner(OWNER)
      }
    ) {
      repeatCount = ValueAnimator.INFINITE
      repeatMode = ValueAnimator.REVERSE
      duration = TimeUnit.SECONDS.toMillis(2)
      interpolator = LinearInterpolator()
    }

    mapView.camera.registerAnimators(anim)

    anim.start()
  }

  companion object {
    private const val OWNER = "Example"
    private const val LATITUDE = 40.0
    private const val LONGITUDE = -74.5
  }
}
```