<sk-linear-gradient-field>

← prev index next →

A directional ramp — weight climbs from zero to full along one axis, the field for "grade this effect smoothly from one side to the other."

Remarks

This is the linear member of the SpatialField family: like every field it turns where into how much — a scalar weight over space that consumers read by #id (field="#id") to vary an effect from place to place. Here the weight depends on how far a point lies along a single direction, so it makes a smooth one-way gradient.

Key attributes. extent is the ramp length: weight is 0 at the field's origin and 1 at extent distance along the gradient axis, clamping to 0 behind the origin and 1 beyond extent, and the inherited remap-curve can reshape that 0→1. The gradient direction is the field's local +Z axis — because the field is a scene-graph node, rotate it (h/p/b, the same convention as cameras and lights) to aim the ramp any way, and move it to slide where the ramp begins. visualize draws the axis and endpoints so the ramp is visible while composing.

Related. It shares the field="#id" model with every field: sibling shapes include sk-spherical-gradient-field (radial rather than directional) and sk-cube-gradient-field. Typical consumers are a sk-tonemap (mask the shading), a sk-simple-point-constraint (per-clone strength), and sk-field-constraint (drive one property).

Serve these docs to run the live example. WebGPU needs a secure context — open this page via grunt serve rather than double-clicking the file. The Markup tab works from disk.

Attributes

AttributeTypeDefaultDescription
id <id> The element's unique identifier — the standard HTML global id attribute.
remap-curveanimatable <remap-curve> Optional remapping curve to reshape the field's [0, 1] output.
remap-phaseanimatable <number> 0 Horizontal remap phase — an animatable scalar that translates a present
extentanimatable <number> 10 Distance from origin to full weight along the local +Z axis.
xanimatable <number> 0 X position.
yanimatable <number> 0 Y position.
zanimatable <number> 0 Z position.
hanimatable <angle> 0 Heading (Y-axis rotation) in radians.
panimatable <angle> 0 Pitch (X-axis rotation) in radians.
banimatable <angle> 0 Bank (Z-axis rotation) in radians.
visualize <boolean> false Whether to show visualization (wireframe splines + center marker). Default: false
interactive-controls <boolean> false Whether to show interactive controls (draggable markers). Requires visualize. Default: false