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

# Use camera animations

Your browser doesn't support HTML5 video. Open [link to the video](https://docs.mapbox.com/ios/ja/ios/ja/assets/medias/CameraAnimation-7a6f9605a1c3aca2066923825093b45b.mp4).

This example demonstrates how to create a Camera Animation using the **Mapbox Maps SDK for iOS**. In this implementation, a [`CameraOptions`](https://docs.mapbox.com/ios/maps/api/latest/documentation/mapboxmaps/cameraoptions/) object is utilized to define the initial camera settings with a specific center location and zoom level. The [`MapView`](https://docs.mapbox.com/ios/maps/api/latest/documentation/mapboxmaps/mapview/) is then initialized with these camera options and displayed on the view. Upon the map loading, the camera animates to a new location over New York City with a different zoom level, bearing, and pitch using the [`ease`](https://docs.mapbox.com/ios/maps/api/latest/documentation/mapboxmaps/cameraanimationsmanager/ease(to:duration:curve:completion:)/) method of the [`CameraAnimationManager`](https://docs.mapbox.com/ios/maps/api/latest/documentation/mapboxmaps/cameraanimationsmanager/).

Moreover, event listeners are configured to handle camera animator events. The code observes and prints information when a camera animation is started or finished, leveraging the [`onCameraAnimatorStarted`](https://docs.mapbox.com/ios/maps/api/latest/documentation/mapboxmaps/cameraanimationsmanager/oncameraanimatorstarted/) and [`onCameraAnimatorFinished`](https://docs.mapbox.com/ios/maps/api/latest/documentation/mapboxmaps/cameraanimationsmanager/oncameraanimatorfinished/) methods provided by the [`CameraAnimationManager`](https://docs.mapbox.com/ios/maps/api/latest/documentation/mapboxmaps/cameraanimationsmanager/). This setup allows developers to track and respond to camera animation events efficiently.

> **Note: iOS Examples App Available**
> 
> This example code is part of the **Maps SDK for iOS Examples App**, a working iOS project [available on Github](https://github.com/mapbox/mapbox-maps-ios/tree/11.29.0/Sources/Examples). iOS 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 iOS Examples App](https://docs.mapbox.com/help/tutorials/maps-sdk-ios-examples-app/) tutorial for step-by-step instructions.

**Swift**

Title: `CameraAnimationExample.swift`

[View on GitHub](https://github.com/mapbox/mapbox-maps-ios/blob/main/Sources/Examples/All%20Examples/CameraAnimationExample.swift)

```swift
import UIKit
import MapboxMaps

final class ViewController: UIViewController {
    private var mapView: MapView!
    private var cancelables = Set<AnyCancelable>()

    override func viewDidLoad() {
        super.viewDidLoad()

        let cameraOptions = CameraOptions(center: CLLocationCoordinate2D(latitude: 42.88, longitude: -78.870000), zoom: 6)
        let mapInitOptions = MapInitOptions(cameraOptions: cameraOptions)
        mapView = MapView(frame: view.bounds, mapInitOptions: mapInitOptions)
        mapView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
        view.addSubview(mapView)

        // Allows the delegate to receive information about map events.
        mapView.mapboxMap.onMapLoaded.observeNext { _ in

            // Center the map camera over New York City.
            let centerCoordinate = CLLocationCoordinate2D(
                latitude: 40.7128, longitude: -74.0060)

            let newCamera = CameraOptions(center: centerCoordinate,
                                          zoom: 7.0,
                                          bearing: 180.0,
                                          pitch: 15.0)

            self.mapView.camera.ease(to: newCamera, duration: 5.0) { [weak self] (_) in
                
                
            }
        }.store(in: &cancelables)

        mapView.camera
            .onCameraAnimatorStarted
            .observe { animator in
                print("Animator started: \(animator.owner)")
            }
            .store(in: &cancelables)

        mapView.camera
            .onCameraAnimatorFinished
            .owned(by: .compass)
            .observe { animator in
                print("Animator finished: \(animator.owner)")
            }
            .store(in: &cancelables)
    }
}
```