Polygon
A Polygon draws a regular polygon (triangle, pentagon, hexagon, etc.) defined by a center point, radius, and number of sides.
Example
Usage
ts
import {
createPolygon,
} from '@ripl/core';
const hexagon = createPolygon({
fillStyle: '#3a86ff',
cx: 200,
cy: 150,
radius: 80,
sides: 6,
});Properties
| Property | Type | Required | Description |
|---|---|---|---|
cx | number | Yes | Center X coordinate |
cy | number | Yes | Center Y coordinate |
radius | number | Yes | Distance from center to vertex |
sides | number | Yes | Number of sides (minimum 3) |
Plus all Element style properties and Shape options.