Rectangle Class
the Rectangle object is an area defined by its position, as indicated by its top-left corner point (x, y) and by its width and its height.
Constructor
Rectangle
(
-
x
-
y
-
width
-
height
Parameters:
-
x
NumberThe X coord of the upper-left corner of the rectangle
-
y
NumberThe Y coord of the upper-left corner of the rectangle
-
width
NumberThe overall width of this rectangle
-
height
NumberThe overall height of this rectangle
Methods
contains
(
Boolean
-
x
-
y
Checks whether the x and y coordinates passed to this function are contained within this Rectangle
Parameters:
-
x
NumberThe X coordinate of the point to test
-
y
NumberThe Y coordinate of the point to test
Returns:
Boolean:
Whether the x/y coords are within this Rectangle
Properties
height
Number
Default: 0
width
Number
Default: 0
x
Number
Default: 0
y
Number
Default: 0