<!--
{
  "availability" : [
    "iOS: 7.0.0 -",
    "iPadOS: 7.0.0 -",
    "macCatalyst: 14.0.0 -",
    "tvOS: 17.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AVFoundation",
  "identifier" : "/documentation/AVFoundation/AVCaptureDevice/ramp(toVideoZoomFactor:withRate:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AVFoundation"
    ],
    "preciseIdentifier" : "c:objc(cs)AVCaptureDevice(im)rampToVideoZoomFactor:withRate:"
  },
  "title" : "ramp(toVideoZoomFactor:withRate:)"
}
-->

# ramp(toVideoZoomFactor:withRate:)

Begins a smooth transition from the current zoom factor to another.

```
func ramp(toVideoZoomFactor factor: CGFloat, withRate rate: Float)
```

## Parameters

`factor`

The new magnification factor.

`rate`

The rate at which to transition to the new magnification factor, specified in powers of two per second.

## Discussion

Allowed values for `factor` range from `1.0` (full field of view) to the [`videoMaxZoomFactor`](/documentation/AVFoundation/AVCaptureDevice/Format/videoMaxZoomFactor) specified by the active capture format.

During a ramp, the zoom factor changes at an exponential rate, but this yields a visually linear transition. The `rate` parameter controls the speed of this transition independent of direction; for example, a value of `1.0` causes zoom factor to double every second if zooming in (that’s, if the specified `factor` is greater than the current [`videoZoomFactor`](/documentation/AVFoundation/AVCaptureDevice/videoZoomFactor)) or halve every second if zooming out.

Before calling this method, you must call [`lockForConfiguration()`](/documentation/AVFoundation/AVCaptureDevice/lockForConfiguration()) to acquire exclusive access to the device’s configuration properties. If you don’t, calling this method raises an exception. When you finish configuring the device, call [`unlockForConfiguration()`](/documentation/AVFoundation/AVCaptureDevice/unlockForConfiguration()) to release the lock and allow other devices to configure the settings.

---

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)