---
title: "CGDisplayFade(_:_:_:_:_:_:_:_:)"
framework: coregraphics
role: symbol
role_heading: Function
path: "coregraphics/cgdisplayfade(_:_:_:_:_:_:_:_:)"
---

# CGDisplayFade(_:_:_:_:_:_:_:_:)

Performs a single fade operation.

## Declaration

```swift
func CGDisplayFade(_ token: CGDisplayFadeReservationToken, _ duration: CGDisplayFadeInterval, _ startBlend: CGDisplayBlendFraction, _ endBlend: CGDisplayBlendFraction, _ redBlend: Float, _ greenBlend: Float, _ blueBlend: Float, _ synchronous: boolean_t) -> CGError
```

## Parameters

- `token`: A reservation token for the fade hardware you acquire by calling doc://com.apple.coregraphics/documentation/CoreGraphics/CGAcquireDisplayFadeReservation(_:_:).
- `duration`: The desired number of seconds for the fade operation. You should use a value in the interval [0, kCGMaxDisplayReservationInterval]. If the value is 0, Quartz applies the ending blend color immediately.
- `startBlend`: An intensity value in the interval [0, 1] that specifies the alpha component of the desired blend color at the beginning of the fade operation. For more information, see doc://com.apple.coregraphics/documentation/CoreGraphics/display-fade-blend-fractions.
- `endBlend`: An intensity value in the interval [0, 1] that specifies the alpha component of the desired blend color at the end of the fade operation. For more information, see doc://com.apple.coregraphics/documentation/CoreGraphics/display-fade-blend-fractions.
- `redBlend`: An intensity value in the interval [0, 1] that specifies the red component of the desired blend color.
- `greenBlend`: An intensity value in the interval [0, 1] that specifies the green component of the desired blend color.
- `blueBlend`: An intensity value in the interval [0, 1] that specifies the blue component of the desired blend color.
- `synchronous`: Pass true if you want the fade operation to be synchronous; otherwise, pass false. If a fade operation is synchronous, the function doesn’t return until the operation is complete.

## Return Value

Return Value A result code. To interpret the result code, see CGError.

## Discussion

Discussion Over the fade operation time interval, Quartz interpolates a blending coefficient between the starting and ending values given, applying a nonlinear (sine-based) bias term. Using this coefficient, Quartz blends the video output with the specified color. The following example shows how to perform a 2-second synchronous fade-out to black: CGDisplayFade (     myToken,     2.0,                        // 2 seconds     kCGDisplayBlendNormal,      // starting state     kCGDisplayBlendSolidColor,  // ending state     0.0, 0.0, 0.0,              // black     true                        // wait for completion ); To perform a 2-second asynchronous fade-in from black: CGDisplayFade (     myToken,     2.0,                        // 2 seconds     kCGDisplayBlendSolidColor,  // starting state     kCGDisplayBlendNormal,      // ending state     0.0, 0.0, 0.0,              // black     false                       // don't wait for completion ); If you specify an asynchronous fade operation, it’s safe to call CGReleaseDisplayFadeReservation(_:) immediately after this function returns.

## See Also

### Functions

- [CGAcquireDisplayFadeReservation(_:_:)](coregraphics/cgacquiredisplayfadereservation(_:_:).md)
- [CGAssociateMouseAndMouseCursorPosition(_:)](coregraphics/cgassociatemouseandmousecursorposition(_:).md)
- [CGBeginDisplayConfiguration(_:)](coregraphics/cgbegindisplayconfiguration(_:).md)
- [CGCancelDisplayConfiguration(_:)](coregraphics/cgcanceldisplayconfiguration(_:).md)
- [CGCaptureAllDisplays()](coregraphics/cgcapturealldisplays().md)
- [CGCaptureAllDisplaysWithOptions(_:)](coregraphics/cgcapturealldisplayswithoptions(_:).md)
- [CGCompleteDisplayConfiguration(_:_:)](coregraphics/cgcompletedisplayconfiguration(_:_:).md)
- [CGConfigureDisplayFadeEffect(_:_:_:_:_:_:)](coregraphics/cgconfiguredisplayfadeeffect(_:_:_:_:_:_:).md)
- [CGConfigureDisplayMirrorOfDisplay(_:_:_:)](coregraphics/cgconfiguredisplaymirrorofdisplay(_:_:_:).md)
- [CGConfigureDisplayMode(_:_:_:)](coregraphics/cgconfiguredisplaymode(_:_:_:).md)
- [CGConfigureDisplayOrigin(_:_:_:_:)](coregraphics/cgconfiguredisplayorigin(_:_:_:_:).md)
- [CGConfigureDisplayStereoOperation(_:_:_:_:)](coregraphics/cgconfiguredisplaystereooperation(_:_:_:_:).md)
- [CGConfigureDisplayWithDisplayMode(_:_:_:_:)](coregraphics/cgconfiguredisplaywithdisplaymode(_:_:_:_:).md)
- [CGCursorIsDrawnInFramebuffer()](coregraphics/cgcursorisdrawninframebuffer().md)
- [CGCursorIsVisible()](coregraphics/cgcursorisvisible().md)
