class Polygon
- Extends:
- Shape
Description:
Polygon is a shape with multiple corners at specified points. Each point is an X and Y coordinate relative to the shapes X and Y position.
Polygon extends Shape class.
Constructor
constructor([stroke=null], [background=null], [opacity=1], [x=0], [y=0], [_points=[]])
Creates an instance of Polygon shape object.
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
|
|
null |
A border of the shape. |
|
|
|
string |
null |
Color, gradient, or image background, similar to CSS. Use an empty string to remove the background. |
|
|
number |
1 |
Opacity of the shape (0 to 1). |
|
|
number |
0 |
Horizontal position from the left edge. |
|
|
number |
0 |
Vertical position from the top edge. |
|
|
Array.<object> |
[] |
An array of point objects that represent each corner of the shape [{x:number,y:number}, ...]. For example a simple start has 10 points. |
Members
- [ readonly ] parent
Methods
From this class:
Inherited from Shape:
- add()
- anchor()
- angle()
- background()
- intersect()
- intersects()
- opacity()
- position()
- stroke()
- subtract()
- visible()
- x()
- y()
