new Thing()
- Source:
Methods
containsPoint(x, y) → {boolean}
Check if a given point is within the Thing.
This function only works in subclasses of Thing.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
x |
number
|
The x coordinate of the point being checked. |
y |
number
|
The y coordinate of the point being checked. |
Returns:
- Type:
-
boolean
Whether the point x, y is within the Thing.
getBorderWidth() → {number}
Gets the width of the Thing's border.
- Source:
Returns:
- Type:
-
number
The width of the Thing's border.
getType() → {type}
Returns the type of a Thing.
- Source:
Returns:
- Type:
-
type
The type of the Thing.
getX() → {number}
Gets the x position of the Thing.
- Source:
Returns:
- Type:
-
number
The x position of the Thing.
getY() → {number}
Gets the y position of the Thing.
- Source:
Returns:
- Type:
-
number
The y position of the Thing.
hasBorder() → {boolean}
Returns if a Thing has a border.
- Source:
Returns:
- Type:
-
boolean
True if the Thing has a border.
isFilled() → {boolean}
Returns if a Thing is filled.
- Source:
Returns:
- Type:
-
boolean
True if the Thing is filled.
move(dx, dy)
Changes the possition of a thing by a specified x and y amount.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
dx |
number
|
The resulting change in the Thing's x position. |
dy |
number
|
The resulting change in the Thing's y position. |
rotate(degrees, angleUnit)
Rotates a Thing an additional amount of degrees.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
degrees |
number
|
The degrees to rotate degrees. |
angleUnit |
number
|
Whether it is degrees or radians. Defaults to degrees. |
setBorder(hasBorder)
Sets a Thing object to filled.
Throws an error if an argument is not passed.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
hasBorder |
bool
|
A boolean of whether or not Thing has a border. |
setBorderColor(color)
Sets the border color of a Thing.
Throws an error if there are fewer than 1 params or if
the param is undefined.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
color |
Color
|
The resulting color of the Thing's border. |
setBorderWidth(width)
Sets the width of a Thing's border.
Throws an error if there is not 1 argument.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
width |
number
|
The resulting width of the Thing's border. |
setColor(color)
Sets the color of a Thing.
Throws an error if there are fewer than 1 params or if
the param is undefined.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
color |
Color
|
The resulting color of Thing. |
setFilled(filled)
Sets a Thing object to filled.
Throws an error if an argument is not passed.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
filled |
bool
|
A boolean of whether or not Thing is filled. |
setPosition(x, y)
Sets the position of a Thing.
Throws an error if there are fewer than 2 params or if
they are not numbers.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
x |
number
|
The destination x coordinate of this Thing. |
y |
number
|
The destination y coordinate of this Thing. |
setRotation(degrees, angleUnit)
Sets the rotation of a Thing in degrees.
Throws an error if there are fewer than 1 params or if they
are not numbers.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
degrees |
number
|
The degrees to rotate degrees. |
angleUnit |
number
|
Whether it is degrees or radians. Defaults to degrees. |
setType(type)
Sets a Thing object's type.
Questionable of whether or not this method is used.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
type |
type
|
A type to set the Thing to. |