Skip to content

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

PortTypeDirectionDescription
outimageRgba16foutputGPU texture of the gradient
colorFieldcolorFieldoutputLightweight color field -- eval(x, y) returns RGBA
scalarFieldscalarFieldoutputLightweight scalar field -- luminance of the gradient

Parameters

ParamTypeDefaultDescription
rampgradientRampblack-to-whiteColor ramp with draggable stops
mappingModeenumLinearLinear, Radial, Angular, or Diamond
positionvec2(0, 0)Center position offset in pixels
scalevec2(1, 1)Scale factor (linked by default)
rotationscalar0Rotation in degrees
repeatModeenumClampClamp, Repeat, or Mirror
cyclescalar0Offset the ramp position (animatable for scrolling gradients)
uniformScalebooleantrueWhen 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:

PortTypeOverrides
position_invec2position
scale_invec2scale
rotation_inscalarrotation
cycle_inscalarcycle

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. t is the distance from center. With uniformScale on, 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
  • 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

Caddis — professional motion design.