| ColorStop | [[ResourceColor](../../ui/ts-types.md#resourcecolor8), number] | Type of the gradient stop. The first parameter specifies the color, and the second parameter specifies the offset, which ranges from 0 to 1.|
| Point | [number, number] | Coordinates of a point. The first parameter is the x-coordinate, and the second parameter is the y-coordinate (relative coordinate).|
## Example
## Example
```ts
```ts
// xxx.ets
@Entry
@Entry
@Component
@Component
structPolygonExample{
structPolygonExample{
...
@@ -55,7 +69,7 @@ struct PolygonExample {
...
@@ -55,7 +69,7 @@ struct PolygonExample {
Flex({justifyContent:FlexAlign.SpaceAround}){
Flex({justifyContent:FlexAlign.SpaceAround}){
// Draw a triangle in a 100 x 100 rectangle. The start point is (0, 0), the end point is (100, 0), and the passing point is (50, 100).
// Draw a triangle in a 100 x 100 rectangle. The start point is (0, 0), the end point is (100, 0), and the passing point is (50, 100).
// Draw a quadrilateral in a 100 x 100 rectangle. The start point is (0, 0), the end point is (100, 0), and the passing point is (100, 100).
// Draw a quadrilateral in a 100 x 100 rectangle. The start point is (0, 0), the end point is (100, 0), and the passing points are (0, 100) and (100, 100).
// Draw a pentagon in a 100 x 100 rectangle. The start point is (50, 0), the end point is (100, 50), and the passing points are (0, 50), (20, 100), and (80, 100).
// Draw a pentagon in a 100 x 100 rectangle. The start point is (50, 0), the end point is (100, 50), and the passing points are (0, 50), (20, 100), and (80, 100).
| Point | [number, number] | Coordinates of a point. The first parameter is the x-coordinate, and the second parameter is the y-coordinate (relative coordinate).|
| options | Object | No | - | Options of the rectangle to draw. For details, see the **options** parameters. |
| width | string \| number | No| 0 | Width of the rectangle. |
| height | string \| number | No| 0 | Height of the rectangle. |
- options parameters
| radius | string \| number \| Array<string \| number> | No| 0 | Radius of the rounded corner. You can set separate radiuses for four rounded corners.|
| Name | Type | Mandatory | Default Value | Description |
| radiusWidth | string \| number | No| 0 | Width of the rounded corner.|
| width | Length | 0 | No | Width of the rectangle. |
| radiusWidth | string \| number | 0 | No| Width of the rounded corner. The width and height are the same when only the width is set.|
| height | Length | 0 | No | Height of the rectangle. |
| radiusHeight | string \| number | 0 | No| Height of the rounded corner. The width and height are the same only when the height is set.|
| radiusWidth | Length | 0 | No | Width of the rounded corner. The width and height are the same when only the width is set. |
| radius | string \| number \| Array<string \| number> | 0 | No| Radius of the rounded corner. You can set separate radiuses for four rounded corners.|
| radiusHeight | Length | 0 | No | Height of the rounded corner. The width and height are the same only when the height is set. |
| fill | [ResourceColor](../../ui/ts-types.md) | Color.Black | No| Color of the fill area.|
| radius | Length \| Array<Length> | 0 | No | Radius of the rounded corner. |
| fillOpacity | number \| string \|[Resource](../../ui/ts-types.md#resource-type)| 1 | No| Opacity of the fill area.|