<!--
{
  "availability" : [
    "iOS: 7.0.0 - 26.0.0",
    "iPadOS: 7.0.0 - 26.0.0",
    "macCatalyst: 13.1.0 - 26.0.0",
    "macOS: 10.9.0 - 26.0.0",
    "tvOS: 9.0.0 - 26.0.0",
    "visionOS: 1.0.0 - 26.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "AVFoundation",
  "identifier" : "/documentation/AVFoundation/AVMutableVideoCompositionLayerInstruction/setCropRectangleRamp(fromStartCropRectangle:toEndCropRectangle:timeRange:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AVFoundation"
    ],
    "preciseIdentifier" : "c:objc(cs)AVMutableVideoCompositionLayerInstruction(im)setCropRectangleRampFromStartCropRectangle:toEndCropRectangle:timeRange:"
  },
  "title" : "setCropRectangleRamp(fromStartCropRectangle:toEndCropRectangle:timeRange:)"
}
-->

# setCropRectangleRamp(fromStartCropRectangle:toEndCropRectangle:timeRange:)

Sets a crop rectangle ramp to apply during the specified time range.

```
func setCropRectangleRamp(fromStartCropRectangle startCropRectangle: CGRect, toEndCropRectangle endCropRectangle: CGRect, timeRange: CMTimeRange)
```

## Parameters

`startCropRectangle`

The crop rectangle to be applied at the starting time of the `timeRange`.

`endCropRectangle`

The crop rectangle to be applied at the end time of the timeRange.

`timeRange`

The time range over which the value of the opacity is interpolated between `startCropRectangle` and `endCropRectangle`.

## Discussion

The origin of the crop rectangle is the top-left corner of the buffer clean aperture rectangle. The crop rectangle is defined in square pixel space, that is, without taking the pixel aspect ratio into account. Crop rectangles extending outside of the clean aperture, are cropped to the clean aperture.

During a crop rectangle ramp, the rectangle is interpolated between the values set at the ramp’s start time and end time. When the starting or ending rectangle is empty, interpolations take into account the origin and size of the empty rectangle.

Before the first specified time for which a crop rectangle is set, the crop rectangle is held constant to <doc://com.apple.documentation/documentation/CoreGraphics/CGRectInfinite> and after the last time for which a crop rectangle is set, the crop rectangle is held constant at that last value.

---

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)