location Parameter DocumentationlocationArray[Array[float, float]]4 (must contain 4 vertices)2 (each vertex contains [x, y] coordinates)left_top)right_top)right_bottom)left_bottom)(0, 0): Top-left corner of the canvas(1, 1): Bottom-right corner of the canvas[0, 1] indicate the shape is partially outside the canvas) normalized_x = actual_x / canvas_width
normalized_y = actual_y / canvas_height | Index | Vertex Name | Description | Example [x, y] |
|---|---|---|---|
0 | left_top | Top-left vertex | [0.2, 0.2] |
1 | right_top | Top-right vertex | [0.6, 0.2] |
2 | right_bottom | Bottom-right vertex | [0.6, 0.6] |
3 | left_bottom | Bottom-left vertex | [0.2, 0.6] |
📌 Key Rules: Vertices must be listed in continuous clockwise or counterclockwise order to form a closed rectangle (if using counterclockwise, ensure the order is continuous and closed; otherwise, rotation and other operations may not work as expected) Coordinate values may exceed [0, 1], indicating the shape is partially outside the canvas (as long as any part is inside, it is considered valid)
{
"location": [
[0.2, 0.2], // left_top
[0.6, 0.2], // right_top
[0.6, 0.6], // right_bottom
[0.2, 0.6] // left_bottom
]
}{
"location": [
[-0.2, -0.2], // left_top
[0.2, -0.2], // right_top
[0.2, 0.2], // right_bottom
[-0.2, 0.2] // left_bottom
]
}"location": [
[0.4, 0.1172], // left_top
[0.6828, 0.4], // right_top
[0.4, 0.6828], // right_bottom
[0.1172, 0.4] // left_bottom
]A positive rotation angle means clockwise; negative means counterclockwise.
📌 Notes: The vertex order must be strictly: left_top, right_top, right_bottom, left_bottom. Incorrect order will return false.Supports rotation and normalized coordinates.
[0, 1] as long as any part of the shape is within the canvas.