> For the complete documentation index, see [llms.txt](https://docs.yarnspinner.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.yarnspinner.dev/2.0/api/csharp/yarn.unity/yarn.unity.effects/yarn.unity.effects.fadealpha.md).

# FadeAlpha(CanvasGroup,float,float,float,Action,InterruptionFlag)

Method in [Effects](/2.0/api/csharp/yarn.unity/yarn.unity.effects.md)

## Summary

A coroutine that fades a `CanvasGroup` object's opacity from `from` to `to` over the course of `fadeTime` seconds, and then invokes `onComplete` . An [InterruptionFlag](/2.0/api/csharp/yarn.unity/yarn.unity.interruptionflag.md) may be used to signal that the fade should be interrupted; if this happens, the opacity is set to `to` .

```csharp
public static IEnumerator FadeAlpha(CanvasGroup canvasGroup, float from, float to, float fadeTime, Action onComplete = null, InterruptionFlag interruption = null)
```

## Parameters

| Name                                                                                                  | Description                                                  |
| ----------------------------------------------------------------------------------------------------- | ------------------------------------------------------------ |
| `float` from                                                                                          | The opacity value to start fading from, ranging from 0 to 1. |
| `float` to                                                                                            | The opacity value to end fading at, ranging from 0 to 1.     |
| `Action` onComplete                                                                                   | A delegate to invoke after fading is complete.               |
| `CanvasGroup` canvasGroup                                                                             |                                                              |
| `float` fadeTime                                                                                      |                                                              |
| [Yarn.Unity.InterruptionFlag](/2.0/api/csharp/yarn.unity/yarn.unity.interruptionflag.md) interruption |                                                              |
