crossfade
Overlap two Videos or Audio values with a crossfade transition.
Call shape
crossfade<T: Video | Audio>(before: T, after: T, duration?: Duration) -> T
This is call-shape notation for lookup, not ClipAsm declaration syntax.
Graph inputs
| Name | Type | Cardinality |
|---|---|---|
before | T | exactly one |
after | T | exactly one |
Parameters and defaults
| Name | Type | Requirement | Default or omission behavior |
|---|---|---|---|
duration | Duration | optional | 500ms |
Result and stack behavior
Outputs: T.
All T inputs and outputs use one homogeneous type: Video or Audio. Use an explicit <Video> or <Audio> argument when the accessible stack makes inference ambiguous.
Default stack access is owned. See stack binding for ownership and visibility rules.
Timeline and markers
The program overlaps the end of before with the start of after. It exposes before, overlap, and after regions.
Example
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.
The reference checks parse and compile this exact example. Compilation does not inspect the named media files.
Behavior
- For Video, duration becomes the smallest whole project-frame count that covers the authored duration; for Audio, it becomes the smallest whole project-sample count.
- Video pictures blend in display-linear BT.709 RGB, while standalone and attached Audio use equal-power fade curves.
- The output exposes before, overlap, and after timeline regions.
Requirements
- before and after must have the same Video or Audio type.
- duration must cover at least one native frame or sample and cannot exceed either input.
Common diagnostics
These are the diagnostics most specific to this program.
E_INVALID_CROSSFADE_DURATION— Invalid crossfade durationE_CROSSFADE_AUDIO_DURATION— Invalid crossfade audio duration