<!--
{
  "availability" : [
    "iOS: 4.0.0 -",
    "iPadOS: 4.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.7.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AVFoundation",
  "identifier" : "/documentation/AVFoundation/AVVideoCompositionLayerInstruction/getOpacityRamp(for:startOpacity:endOpacity:timeRange:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AVFoundation"
    ],
    "preciseIdentifier" : "c:objc(cs)AVVideoCompositionLayerInstruction(im)getOpacityRampForTime:startOpacity:endOpacity:timeRange:"
  },
  "title" : "getOpacityRamp(for:startOpacity:endOpacity:timeRange:)"
}
-->

# getOpacityRamp(for:startOpacity:endOpacity:timeRange:)

Obtains the opacity ramp that includes a specified time.

```
func getOpacityRamp(for time: CMTime, startOpacity: UnsafeMutablePointer<Float>?, endOpacity: UnsafeMutablePointer<Float>?, timeRange: UnsafeMutablePointer<CMTimeRange>?) -> Bool
```

## Parameters

`time`

If a ramp with a time range that contains the specified time has been set, information about the effective ramp for that time is supplied. Otherwise, information about the first ramp that starts after the specified time is supplied.

`startOpacity`

A pointer to a float to receive the starting opacity value for the opacity ramp.

    This value may be     `NULL`    .

`endOpacity`

A pointer to a float to receive the ending opacity value for the opacity ramp.

    This value may be     `NULL`    .

`timeRange`

A pointer to a `CMTimeRange` to receive the time range of the opacity ramp.

    This value may be     `NULL`    .

## Return Value

<doc://com.apple.documentation/documentation/Swift/true> if values are returned successfully, otherwise <doc://com.apple.documentation/documentation/Swift/false>. <doc://com.apple.documentation/documentation/Swift/false> is returned if `time` is beyond the duration of the last opacity ramp that has been set.

## Discussion

---

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)