# crossfade
Overlap two Videos with a crossfade transition.
## Call shape
```text
crossfade(before: Video, after: Video, duration?: Duration) -> Video
```
This is call-shape notation for lookup, not ClipAsm declaration syntax.
## Graph inputs
| `before` | `Video` | exactly one |
| `after` | `Video` | exactly one |
## Parameters and defaults
| `duration` | `Duration` | optional | 500ms |
## Result and stack behavior
Outputs: `Video`.
Default stack access is **owned**. See [stack binding](../language/stack-binding.md) for ownership and visibility rules.
## Timeline and markers
Overlaps the end of `before` with the start of `after` and exposes `before`, `overlap`, and `after` regions.
## Example
```clipasm
clipasm 1
config {
video {
fps = 30
}
}
image("assets/before.png", 2s)
image("assets/after.png", 2s)
crossfade
```
Expected validation result: `Video` with exactly 105 project frames at the example's explicit `fps = 30`.
This exact example is parsed and compiled by the reference checks; compilation does not inspect the named media files.
## Behavior
- duration becomes the smallest whole project-frame count that covers the authored duration.
- The output exposes before, overlap, and after timeline regions.
## Requirements
- duration must cover at least one project frame and cannot exceed either input Video.
## Common diagnostics
These are the diagnostics most specific to this program.
- [`E_INVALID_CROSSFADE_DURATION`](https://nikitamgrimm.github.io/clipasm/diagnostics/#e_invalid_crossfade_duration) — Invalid crossfade duration
## See also
- [`flash_cut`](flash_cut.md)
- [Statements and calls](../language/statements-and-calls.md)
- [Stack binding](../language/stack-binding.md)