Gradient
Generates a spatial color gradient. Supports Linear, Radial, Angular, and Diamond mapping modes with repeat, and outputs GPU texture, colorField, and scalarField.
Category: Fields Menu path: Fields > Gradient
Ports
| Port | Type | Direction | Description |
|---|---|---|---|
out | imageRgba16f | output | GPU texture of the gradient |
colorField | colorField | output | Lightweight color field -- eval(x, y) returns RGBA |
scalarField | scalarField | output | Lightweight scalar field -- luminance of the gradient |
Parameters
| Param | Type | Default | Description |
|---|---|---|---|
ramp | gradientRamp | black-to-white | Color ramp with draggable stops |
mappingMode | enum | Linear | Linear, Radial, Angular, or Diamond |
position | vec2 | (0, 0) | Center position offset in pixels |
scale | vec2 | (1, 1) | Scale factor (linked by default) |
rotation | scalar | 0 | Rotation in degrees |
repeatMode | enum | Clamp | Clamp, Repeat, or Mirror |
cycle | scalar | 0 | Offset the ramp position (animatable for scrolling gradients) |
uniformScale | boolean | true | When enabled, both axes normalize by max(width, height) for aspect-correct shapes |
Expose Channels
When enabled (E button on node header), adds input ports that override params via edge connections:
| Port | Type | Overrides |
|---|---|---|
position_in | vec2 | position |
scale_in | vec2 | scale |
rotation_in | scalar | rotation |
cycle_in | scalar | cycle |
How It Works
Gradient is a terminal generator -- it fills the entire canvas, requiring no input. The GPU shader evaluates each pixel's position through the selected mapping function to produce a t value, which is then looked up in the gradient ramp.
Mapping modes:
- Linear: Straight line gradient. The ramp maps from one side to the other along the rotation axis.
- Radial: Circular gradient.
tis the distance from center. WithuniformScaleon, this produces a perfect circle (not an ellipse). - Angular: Conical sweep around the center point.
- Diamond: Diamond-shaped falloff from center.
Repeat modes:
- Clamp: Values beyond the ramp edges stay at the edge color.
- Repeat: Tiles the gradient (sharp restart).
- Mirror: Tiles with alternating direction (smooth bounce).
Cycle: Offsets t before the repeat mode is applied. Animate this to scroll the gradient through space.
Field outputs: The colorField and scalarField outputs are lightweight CPU structs shared via Arc. They use a GradientEvaluator that applies the same mapping logic as the GPU shader. Consumer nodes (PointAttributes, ShapeAttributes, DrawAscii, etc.) sample them per-element.
Viewport gizmo: When a Gradient node is selected, an interactive SVG overlay appears in the viewer. The handles are mode-specific: Linear shows endpoints, Radial shows center + radius handle, Angular/Diamond show center + tip.
Usage Examples
Basic: Background gradient
Gradient (Linear, ramp: dark blue to black) -> Transform2D -> Output. Simple background layer.
Radial vignette
Gradient (Radial, ramp: white center to black edge, scale: 0.7) -> connect to a Mix node mask or Merge foreground.
Color field for shapes
Gradient.colorField -> ShapeAttributes (target: Color) -> DrawShape. Shapes pick up gradient colors at their vertex positions.
Scrolling pattern
Set repeatMode to Repeat. Keyframe cycle from 0 to 1 over the comp duration. The gradient tiles scroll continuously.
Animated position
Enable expose channels. Connect Math expressions to position_in for a gradient that follows motion paths.
Tips
uniformScale(default on) ensures Radial produces circles, not ellipses. Turn off for stretched gradients.- The gradient ramp widget supports shift+click multi-select on stops, proportional scale handles, and per-stop color picker
- Drag color tokens onto gradient stops to link them
- Cycle is the key param for looping gradient animations with Repeat mode
- Gradient fills the entire canvas regardless of what's upstream -- it is a terminal generator
Related Nodes
- Colorize -- maps existing image luminance through a color ramp (vs. spatial gradient)
- Noise -- procedural texture generation (vs. smooth gradient)
- DistanceField -- shape-based falloff (vs. geometric gradient shapes)
- ShapeAttributes -- apply gradient colorField to shape vertices
- PointAttributes -- apply gradient colorField to points