<!--
{
  "availability" : [
    "iOS: 17.0.0 -",
    "iPadOS: 17.0.0 -",
    "macOS: 14.0.0 -",
    "tvOS: 17.0.0 -",
    "watchOS: 10.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/View/mapCameraKeyframeAnimator(trigger:keyframes:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI",
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI4ViewP08_MapKit_aB0E25mapCameraKeyframeAnimator7trigger9keyframesQrqd___qd_0_AD0dG0VctSQRd__AA9KeyframesRd_0_AI5ValueRtd_0_r0_lF"
  },
  "title" : "mapCameraKeyframeAnimator(trigger:keyframes:)"
}
-->

# mapCameraKeyframeAnimator(trigger:keyframes:)

Uses the given keyframes to animate the camera of a `Map` when the
given trigger value changes.

```
@MainActor @preconcurrency func mapCameraKeyframeAnimator(trigger: some Equatable, @KeyframesBuilder<MapCamera> keyframes: @escaping (MapCamera) -> some Keyframes<MapCamera>) -> some View
```

## Parameters

`trigger`

A value to observe for changes.

`keyframes`

A keyframes builder closure that is called when starting
a new keyframe animation. The current map camera is provided as the
only parameter.

## Discussion

When the trigger value changes, the map calls the `keyframes` closure
to generate the keyframes that will animate the camera. The animation
will continue for the duration of the keyframes that you specify.

If the user performs a gesture while the animation is in progress, the
animation will be immediately removed, allowing the interaction to take
control of the camera.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)