You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/componentsguide/styles/fill/index.md
+33
Original file line number
Diff line number
Diff line change
@@ -40,3 +40,36 @@ Styling a feature
40
40
-**Type**: `Number`
41
41
42
42
The color either in hexadecimal or as RGB array with red, green, and blue values between 0 and 255 and alpha between 0 and 1 inclusive.
43
+
44
+
### gradient
45
+
-**Type**: `Object`
46
+
```
47
+
{
48
+
"type": "linear", // Type of gradient. Here, it's a linear gradient.
49
+
"x0": 0, // x-coordinate of the starting point. Indicates the horizontal position where the gradient starts.
50
+
"y0": 0, // y-coordinate of the starting point. Indicates the vertical position where the gradient starts.
51
+
"x1": 0, // x-coordinate of the ending point. This is the horizontal position where the gradient ends. It’s the same as x0, meaning the gradient is vertical.
52
+
"y1": 256, // y-coordinate of the ending point. Indicates the vertical position where the gradient ends, extending the gradient to y = 256.
53
+
"colorStops": [
54
+
[0, "red"], // Start color at position 0. The color at the beginning of the gradient is red.
55
+
[0.5, "yellow"], // Middle color at position 0.5. The color at the midpoint of the gradient (y = 128) is yellow.
56
+
[1, "green"] // End color at position 1. The color at the end of the gradient (y = 256) is green.
57
+
]
58
+
}
59
+
60
+
{
61
+
"type": "radial", // Type of gradient. Here, it's a radial gradient.
62
+
"x0": 128, // x-coordinate of the starting circle's center. Specifies the horizontal position of the starting circle.
63
+
"y0": 128, // y-coordinate of the starting circle's center. Specifies the vertical position of the starting circle.
64
+
"r0": 0, // Radius of the starting circle. Here, it's 0, meaning the gradient starts at a single point.
65
+
"x1": 128, // x-coordinate of the ending circle's center. Same as x0, so the ending circle is centered at the same horizontal position.
66
+
"y1": 128, // y-coordinate of the ending circle's center. Same as y0, so the ending circle is centered at the same vertical position.
67
+
"r1": 128, // Radius of the ending circle. Specifies the radius of the circle where the gradient ends, extending to a radius of 128 units.
68
+
"colorStops": [
69
+
[0, "blue"], // Color at the center of the gradient (r = 0). The color at the very center of the radial gradient is blue.
70
+
[0.5, "cyan"], // Color at the midpoint of the gradient. At the midpoint of the radius (r = 64), the color is cyan.
71
+
[1, "white"] // Color at the edge of the gradient (r = 128). The color at the outer edge of the radial gradient is white.
0 commit comments