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

# Fly-to camera animation

![Animate the camera changes with the fly-to animation. This causes the camera to ease from a starting point to an end destination.](https://docs.mapbox.com/android/ja/assets/ideal-img/maps-examples-fly-to-camera-animation.d2e2450.480.png)

This example demonstrates the usage of [`MapboxMap.flyTo`](https://docs.mapbox.com/android/maps/api/latest/mapbox-maps-android/com.mapbox.maps.plugin.animation/fly-to.html) on a map with globe projection, atmosphere, and terrain to smoothly zoom to a specified location with the **Maps SDK for Android**. The `GlobeFlyToActivity` class and implements [`OnMapClickListener`](https://docs.mapbox.com/android/maps/api/latest/mapbox-maps-android/com.mapbox.maps.plugin.gestures/-on-map-click-listener/). Within the `onCreate` method, the app sets up the [`MapView`](https://docs.mapbox.com/android/maps/api/latest/mapbox-maps-android/com.mapbox.maps/-map-view/), loads the style with a globe projection, configures atmosphere settings including color and horizon blend, adds a raster DEM source, and enables terrain rendering. Upon completion of the map setup, a Toast message guides users to tap on the map to trigger the fly-to animation.

When the user taps on the map, the [`onMapClick`](https://docs.mapbox.com/android/maps/api/latest/mapbox-maps-android/com.mapbox.maps.plugin.gestures/-on-map-click-listener/on-map-click.html) function is triggered to determine the target camera location based on the current state, and the [`flyTo`](https://docs.mapbox.com/android/maps/api/latest/mapbox-maps-android/com.mapbox.maps.plugin.animation/fly-to.html) method is called on the `mapboxMap` with animation options specifying a duration of 12 seconds. The camera options for the start and end locations are stored as constants within a private companion object. This example provides a seamless zooming experience to showcase the globe view of the map with atmospheric effects.

> **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.28.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: `GlobeFlyToActivity.kt`

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

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

import android.graphics.Color.rgb
import android.os.Bundle
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import com.mapbox.geojson.Point
import com.mapbox.maps.MapView
import com.mapbox.maps.MapboxMap
import com.mapbox.maps.Style
import com.mapbox.maps.dsl.cameraOptions
import com.mapbox.maps.extension.style.atmosphere.generated.atmosphere
import com.mapbox.maps.extension.style.layers.properties.generated.ProjectionName
import com.mapbox.maps.extension.style.projection.generated.projection
import com.mapbox.maps.extension.style.sources.generated.rasterDemSource
import com.mapbox.maps.extension.style.style
import com.mapbox.maps.extension.style.terrain.generated.terrain
import com.mapbox.maps.plugin.animation.MapAnimationOptions.Companion.mapAnimationOptions
import com.mapbox.maps.plugin.animation.flyTo
import com.mapbox.maps.plugin.gestures.OnMapClickListener
import com.mapbox.maps.plugin.gestures.addOnMapClickListener
import com.mapbox.maps.testapp.R

/**
 * Use [MapboxMap.flyTo] on a map with globe projection, atmosphere and terrain to slowly zoom to a location.
 */
class GlobeFlyToActivity : AppCompatActivity(), OnMapClickListener {

  private lateinit var mapboxMap: MapboxMap
  private var isAtStart = true

  override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    val mapView = MapView(this)
    setContentView(mapView)
    mapboxMap = mapView.mapboxMap
    mapboxMap.loadStyle(
      style(Style.STANDARD_SATELLITE) {
        +projection(ProjectionName.GLOBE)
        +atmosphere {
          color(rgb(220, 159, 159)) // Pink fog / lower atmosphere
          highColor(rgb(220, 159, 159)) // Blue sky / upper atmosphere
          horizonBlend(0.4) // Exaggerate atmosphere (default is .1)
        }
        +rasterDemSource("raster-dem") {
          url("mapbox://mapbox.terrain-rgb")
        }
        +terrain("raster-dem")
      }
    ) {
      // Toast instructing user to tap on the map
      Toast.makeText(
        this@GlobeFlyToActivity,
        getString(R.string.tap_on_map_instruction),
        Toast.LENGTH_LONG
      ).show()
      mapboxMap.addOnMapClickListener(this@GlobeFlyToActivity)
    }
  }

  override fun onMapClick(point: Point): Boolean {
    val target = if (isAtStart) CAMERA_END else CAMERA_START
    isAtStart = !isAtStart
    mapboxMap.flyTo(
      target,
      mapAnimationOptions {
        duration(12_000)
      }
    )
    return true
  }

  private companion object {
    private val CAMERA_START = cameraOptions {
      center(Point.fromLngLat(80.0, 36.0))
      zoom(1.0)
      pitch(0.0)
      bearing(0.0)
    }
    private val CAMERA_END = cameraOptions {
      center(Point.fromLngLat(8.11862, 46.58842))
      zoom(12.5)
      pitch(75.0)
      bearing(130.0)
    }
  }
}
```