Contents

mapCameraKeyframeAnimator(trigger:keyframes:)

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

Declaration

@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.

See Also

Getting location information