---
title: "mapCameraKeyframeAnimator(trigger:keyframes:)"
framework: swiftui
role: symbol
role_heading: Instance Method
path: "swiftui/view/mapcamerakeyframeanimator(trigger:keyframes:)"
---

# mapCameraKeyframeAnimator(trigger:keyframes:)

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

## Declaration

```swift
@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

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.

## See Also

### Getting location information

- [LocationButton](corelocationui/locationbutton.md)
- [Map](mapkit/map.md)
- [mapStyle(_:)](swiftui/view/mapstyle(_:).md)
- [mapScope(_:)](swiftui/view/mapscope(_:).md)
- [mapFeatureSelectionDisabled(_:)](swiftui/view/mapfeatureselectiondisabled(_:).md)
- [mapFeatureSelectionAccessory(_:)](swiftui/view/mapfeatureselectionaccessory(_:).md)
- [mapFeatureSelectionContent(content:)](swiftui/view/mapfeatureselectioncontent(content:).md)
- [mapControls(_:)](swiftui/view/mapcontrols(_:).md)
- [mapControlVisibility(_:)](swiftui/view/mapcontrolvisibility(_:).md)
- [lookAroundViewer(isPresented:scene:allowsNavigation:showsRoadLabels:pointsOfInterest:onDismiss:)](swiftui/view/lookaroundviewer(ispresented:scene:allowsnavigation:showsroadlabels:pointsofinterest:ondismiss:).md)
- [lookAroundViewer(isPresented:initialScene:allowsNavigation:showsRoadLabels:pointsOfInterest:onDismiss:)](swiftui/view/lookaroundviewer(ispresented:initialscene:allowsnavigation:showsroadlabels:pointsofinterest:ondismiss:).md)
- [onMapCameraChange(frequency:_:)](swiftui/view/onmapcamerachange(frequency:_:).md)
- [mapItemDetailPopover(isPresented:item:displaysMap:attachmentAnchor:)](swiftui/view/mapitemdetailpopover(ispresented:item:displaysmap:attachmentanchor:).md)
- [mapItemDetailPopover(isPresented:item:displaysMap:attachmentAnchor:arrowEdge:)](swiftui/view/mapitemdetailpopover(ispresented:item:displaysmap:attachmentanchor:arrowedge:).md)
- [mapItemDetailPopover(item:displaysMap:attachmentAnchor:)](swiftui/view/mapitemdetailpopover(item:displaysmap:attachmentanchor:).md)
