---
title: "getOpacityRamp(for:startOpacity:endOpacity:timeRange:)"
framework: avfoundation
role: symbol
role_heading: Instance Method
path: "avfoundation/avvideocompositionlayerinstruction/getopacityramp(for:startopacity:endopacity:timerange:)"
---

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

Obtains the opacity ramp that includes a specified time.

## Declaration

```swift
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

Return Value true if values are returned successfully, otherwise false. false is returned if time is beyond the duration of the last opacity ramp that has been set.

## See Also

### Getting opacity, transform, and cropping ramps

- [cropRectangleRamp(at:)](avfoundation/avvideocompositionlayerinstruction/croprectangleramp(at:).md)
- [AVVideoCompositionLayerInstruction.CropRectangleRamp](avfoundation/avvideocompositionlayerinstruction/croprectangleramp.md)
- [getCropRectangleRamp(for:startCropRectangle:endCropRectangle:timeRange:)](avfoundation/avvideocompositionlayerinstruction/getcroprectangleramp(for:startcroprectangle:endcroprectangle:timerange:).md)
- [opacityRamp(at:)](avfoundation/avvideocompositionlayerinstruction/opacityramp(at:).md)
- [AVVideoCompositionLayerInstruction.OpacityRamp](avfoundation/avvideocompositionlayerinstruction/opacityramp.md)
- [transformRamp(at:)](avfoundation/avvideocompositionlayerinstruction/transformramp(at:).md)
- [AVVideoCompositionLayerInstruction.TransformRamp](avfoundation/avvideocompositionlayerinstruction/transformramp.md)
- [getTransformRamp(for:start:end:timeRange:)](avfoundation/avvideocompositionlayerinstruction/gettransformramp(for:start:end:timerange:).md)
