Style
LinearGradient
A fill that blends colors along a line.
Object type style pins
A LinearGradient blends its stops along the line from start to end.
Across that line, the color stays the same. Before the start and after the
end, the first and last stop's colors continue.
Hierarchy
- Parents
Paint- Subtypes
- None
Properties
Nodes
Break LinearGradient
Node id break/LinearGradient
Inputs
| Name | Type | Default | Notes |
|---|---|---|---|
| object | LinearGradient | type default |
Outputs
Make LinearGradient
Node id make/LinearGradient
Inputs
| Name | Type | Default | Notes |
|---|---|---|---|
| start | Point | { x: -50, y: 0 } | |
| end | Point | { x: 50, y: 0 } | |
| stops | Array<ColorStop> | [{ offset: 0, color: { r: 0, g: 0, b: 0, a: 1 } }, { offset: 1, color: { r: 255, g: 255, b: 255, a: 1 } }] |
Outputs
| Name | Type | Notes |
|---|---|---|
| object | LinearGradient |
Set LinearGradient
Node id set/LinearGradient
Inputs
| Name | Type | Default | Notes |
|---|---|---|---|
| object | LinearGradient | type default | |
| start | Point | — | |
| end | Point | — | |
| stops | Array<ColorStop> | — |
Outputs
| Name | Type | Notes |
|---|---|---|
| object | LinearGradient |
Lerp LinearGradient
Node id lerp/LinearGradient
Inputs
| Name | Type | Default | Notes |
|---|---|---|---|
| a | LinearGradient | type default | |
| b | LinearGradient | type default | |
| t | number | 0.5 |
Outputs
| Name | Type | Notes |
|---|---|---|
| result | LinearGradient |
Notes
- Shape units.
startandendare in the shape's own units, before its position, rotation and scale (like a Polygon's vertices), so the gradient moves, turns and scales with the shape. (0, 0) is the shape's position: the center of a Circle or a Rectangle. - Default. Make LinearGradient goes from (−50, 0) to (50, 0), black to white: across a shape 100 wide, centered.
- Stops. An array of ColorStops, read in offset order. Stops at the same offset make a hard edge, and a single stop is a flat color. A gradient with no stops is a node error.
- Spanning nothing. If
startandendare the same point, the shape is filled with the last stop's color. - Used as a Shape's fill or a Stroke's color (a Paint).
Lerp
Lerp LinearGradient blends start, end and the stops, pairwise in offset order (offset
and color). That needs as many stops on both sides: with different counts
the result is a copy of a below t = 0.5 and of b from 0.5 on. t is
clamped to 0, 1.
Related types
- RadialGradient, ColorStop and Paint.
- A glowing ball in a gradient frame, a worked example.