class Rectangle
- Extends:
- Shape
Description:
Rectangle shape can draw a rectangles (if width and height are different) and a square (when width and height are same.
Rectangle class extends Shape class.
Constructor
constructor([stroke], [background], [opacity=1], [x=0], [y=0], [width=100], [height])
Creates an instance of Rectangle shape.
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
|
|
A border of the shape. |
||
|
|
string |
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. |
|
|
number |
100 |
Width of the ellipse (horizontal diameter). |
|
|
number |
Height of the ellipse (vertical diameter). If omitted, height will be same as width. |
Members
- [ readonly ] parent
Methods
From this class:
Inherited from Shape:
- add()
- anchor()
- angle()
- background()
- intersect()
- intersects()
- opacity()
- position()
- stroke()
- subtract()
- visible()
- x()
- y()
