<!--
{
  "availability" : [
    "MapKit JS: 5.23.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "MapKitJS",
  "identifier" : "/documentation/MapKitJS/Map/setCameraDistanceAnimated",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "MapKit JS"
    ],
    "preciseIdentifier" : "instm/mapkit.Map/setCameraDistanceAnimated"
  },
  "title" : "setCameraDistanceAnimated(distance, animated)"
}
-->

# setCameraDistanceAnimated(distance, animated)

Changes the map’s camera distance with an animated transition.

```
setCameraDistanceAnimated(distance: number, animated?: boolean): Map;
```

## Parameters

`distance`

The altitude of the camera from the center of the map. It’s value needs to be greater than or equal to `0`.

`animate`

A Boolean value that determines whether MapKit JS animates the visible area change. The default value is `true`.

## Return Value

Returns the containing map instance object.

## Discussion

By default, the change of distance animates.

---

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)