<!--
{
  "availability" : [
    "iOS: 26.4.0 -",
    "iPadOS: 26.4.0 -",
    "macCatalyst: 26.4.0 -",
    "macOS: 26.0.0 -",
    "visionOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "ImmersiveMediaSupport",
  "identifier" : "/documentation/ImmersiveMediaSupport/FadeCommand",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Immersive Media Support"
    ],
    "preciseIdentifier" : "s:21ImmersiveMediaSupport11FadeCommandV"
  },
  "title" : "FadeCommand"
}
-->

# FadeCommand

A command type for color fading during immersive media playback.

```
struct FadeCommand
```

## Overview

Color fades are used to either fading in into the video frame from the requested color or fading out of the video frame to the requested color. The fade commands are usually used for fading in at the start of the playback and fading out at the end of the playback. These commands are also used during immersive camera view switches during the playback.

Fade commands can be absolute time based or offset based. If fade commands are absolute time based, then property time dictates the time it needs to start executing and keep fading until the duration property value. On the other hand if they are offset based, then offset property dictates the fade percentage from the start time of the fade command till the duration of the fade. If the fade has to start at time 0.0 second of the playback for duration of 1.0 seconds and if the media FPS is 90, then first frame should be accompanied with presentation metadata with fade command which has 0.011 as offset. Second frame should have fade command with offset 0.022 and so on. For the 90th frame, we should receive offset 1.0.

## Topics

### Initializers

[`init(from: any Decoder) throws`](/documentation/ImmersiveMediaSupport/FadeCommand/init(from:))

### Instance Properties

[`var color: simd_float3`](/documentation/ImmersiveMediaSupport/FadeCommand/color)

The fade color value ranging from `0.0` to `1.0` for each color channel representing RGB color space.
If the color is set to black, and the direction is `in`, then it fades from black to the video frame.

[`var direction: FadeCommand.FadeDirection`](/documentation/ImmersiveMediaSupport/FadeCommand/direction)

Fade direction for this command instance.

[`var duration: CMTime`](/documentation/ImmersiveMediaSupport/FadeCommand/duration)

The duration of the command.

[`var id: Int`](/documentation/ImmersiveMediaSupport/FadeCommand/id)

A unique command ID for the entire immersive media file.

[`var offset: CMTime?`](/documentation/ImmersiveMediaSupport/FadeCommand/offset)

The offset from the start time of this command.

[`var time: CMTime`](/documentation/ImmersiveMediaSupport/FadeCommand/time)

The time this command starts during playback.

### Instance Methods

[`func encode(to: any Encoder) throws`](/documentation/ImmersiveMediaSupport/FadeCommand/encode(to:))

### Enumerations

[`enum FadeDirection`](/documentation/ImmersiveMediaSupport/FadeCommand/FadeDirection)

A value that represents the direction of the fade command.

### Initializers

[`init(id: Int, time: CMTime, duration: CMTime, direction: FadeCommand.FadeDirection, color: simd_float3, offset: CMTime?)`](/documentation/ImmersiveMediaSupport/FadeCommand/init(id:time:duration:direction:color:offset:))

Initializes a color fade command.

## Relationships

### Conforms To

[`Sendable`](/documentation/Swift/Sendable)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

---

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)