Constructor
new Rectangle()
- Description:
- Create a Rectangle object
- Source:
Properties:
Name | Type | Description |
---|---|---|
point |
Point | X & Y axis coordinates |
aspect |
Aspect | Aspect properties |
round |
Array | Rounding properties |
stroke |
Stroke | Stroke properties |
fill |
Fill | Fill properties |
shadow |
Shadow | Shadow properties |
anchor |
Anchor | Anchor properties |
canvas |
HTMLCanvasElement | 2D canvas context |
options |
Options | Options for this object |
position |
Position | Position properties |
mass |
number | Mass of object |
velocity |
Point | X & Y velocity coordinates |
Methods
anchor() → {Anchor}
- Description:
- Get anchor
- Source:
Returns:
Anchor properties
- Type
- Anchor
area() → {number}
- Description:
- Get area of this object
- Source:
- See:
Returns:
Area of this object
- Type
- number
aspect(value)
- Description:
- Set aspect properties
- Source:
Parameters:
Name | Type | Description |
---|---|---|
value |
Aspect | Aspect properties |
aspect() → {Aspect}
- Description:
- Get aspect properties
- Source:
Returns:
Aspect properties
- Type
- Aspect
canvas(value)
- Description:
- Set canvas value
- Source:
- See:
Parameters:
Name | Type | Description |
---|---|---|
value |
string | Canvas id |
canvas() → {string}
- Description:
- Get canvas value
- Source:
- See:
Returns:
Canvas id
- Type
- string
center() → {Point}
- Description:
- Get center of this object
- Source:
- See:
Returns:
Center point coordinates
- Type
- Point
draw(canvas)
- Description:
- Draw this object
- Source:
Parameters:
Name | Type | Description |
---|---|---|
canvas |
string | Canvas Id |
fill(value)
- Description:
- Get fill properties
- Source:
Parameters:
Name | Type | Description |
---|---|---|
value |
Fill | Fill properties |
fill() → {Fill}
- Description:
- Get fill properties
- Source:
Returns:
Fill properties
- Type
- Fill
fillColorCycle(progress, start, end, maxopt)
- Description:
- Cycle colors for fill
- Source:
- See:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
progress |
number | Progress time unit between; 0.00 - 1.00 | ||
start |
Rgb | Starting RGB value | ||
end |
Rgb | Ending RGB value | ||
max |
number |
<optional> |
1
|
Maximum increments |
gradientColorCycle(progress, start, end, stop, maxopt)
- Description:
- Cycle colors for gradient
- Source:
- See:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
progress |
number | Progress time unit between; 0.00 - 1.00 | ||
start |
Rgb | Starting RGB value | ||
end |
Rgb | Ending RGB value | ||
stop |
number | Gradient color stop | ||
max |
number |
<optional> |
1
|
Maximum increments |
height(value)
- Description:
- Set aspect height
- Source:
Parameters:
Name | Type | Description |
---|---|---|
value |
number | Height value |
height() → {number}
- Description:
- Get aspect height
- Source:
Returns:
Height value
- Type
- number
isThere(rectangle)
- Description:
- Check whether the passed object is already present
- Source:
Parameters:
Name | Type | Description |
---|---|---|
rectangle |
Rectangle | Object to validate |
mass(value)
- Description:
- Set mass
- Source:
Parameters:
Name | Type | Description |
---|---|---|
value |
number | Mass of object |
mass() → {number}
- Description:
- Get mass
- Source:
Returns:
Mass of object
- Type
- number
move(degree, distance, drawopt, clearopt)
- Description:
- Move this object
- Source:
- See:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
degree |
number | Direction to move; in degrees | ||
distance |
number | Distance to move | ||
draw |
boolean |
<optional> |
false
|
Draw post movement |
clear |
boolean |
<optional> |
false
|
Clear canvas during each movement |
options() → {Options}
- Description:
- Get options properties
- Source:
Returns:
Options properties
- Type
- Options
perimeter() → {number}
- Description:
- Get perimeter
- Source:
- See:
Returns:
Perimeter of rectangle
- Type
- number
point(value)
- Description:
- Set point
- Source:
- See:
Parameters:
Name | Type | Description |
---|---|---|
value |
Point | X & Y coordinates |
point() → {Point}
- Description:
- Get point
- Source:
- See:
Returns:
X & Y coordinates
- Type
- Point
rotate(degree, anchoropt, clearopt)
- Description:
- Rotate this object
- Source:
- See:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
degree |
number | Distance to rotate; in degrees | ||
anchor |
string |
<optional> |
'center'
|
Anchoring point during rotation |
clear |
number |
<optional> |
true
|
Clear canvas during each rotation |
round(value)
- Description:
- Set round properties
- Source:
Parameters:
Name | Type | Description |
---|---|---|
value |
Array | Radii properties |
round() → {Array}
- Description:
- Get round properties
- Source:
Returns:
Radii properties
- Type
- Array
shadow() → {Shadow}
- Description:
- Get shadow properties
- Source:
Returns:
Shadow properties
- Type
- Shadow
showCoordinates(offsetopt, fontSizeopt)
- Description:
- Shows coordinates of this object
- Source:
- See:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
offset |
number |
<optional> |
10
|
Offset of coordinates y origin |
fontSize |
number |
<optional> |
16
|
Coordinates font size |
stroke(value)
- Description:
- Set stroke properties
- Source:
Parameters:
Name | Type | Description |
---|---|---|
value |
Stroke | Stroke properties |
stroke() → {Stroke}
- Description:
- Get stroke properties
- Source:
Returns:
Stroke properties
- Type
- Stroke
velocity(value)
- Description:
- Set velocity
- Source:
Parameters:
Name | Type | Description |
---|---|---|
value |
number | Velocity of object |
velocity() → {number}
- Description:
- Get velocity
- Source:
Returns:
Velocity of object
- Type
- number
width(value)
- Description:
- Set aspect width
- Source:
Parameters:
Name | Type | Description |
---|---|---|
value |
number | Width value |
width() → {number}
- Description:
- Get aspect with
- Source:
Returns:
Width value
- Type
- number
x(value)
- Description:
- Set x-axis value
- Source:
- See:
Parameters:
Name | Type | Description |
---|---|---|
value |
number | X coordinate value |
x() → {number}
- Description:
- Get x-axis value
- Source:
- See:
Returns:
X coordinate value
- Type
- number
y(value)
- Description:
- Set y-axis value
- Source:
- See:
Parameters:
Name | Type | Description |
---|---|---|
value |
number | Y coordinate value |
y() → {number}
- Description:
- Get y-axis value
- Source:
- See:
Returns:
Y coordinate value
- Type
- number