Class jaws.Rect
A Basic rectangle.
- Defined in: rect.js
Constructor Attributes | Constructor Name and Description |
---|---|
jaws.Rect(x, y, width, height)
|
Method Summary
Method Attributes | Method Name and Description |
---|---|
clone()
Returns a new rect witht he same dimensions
|
|
collidePoint(x, y)
Returns true if point at x, y lies within calling rect
|
|
collideRect(rect)
Returns true if calling rect overlaps with given rect in any way
|
|
draw()
Draw rect in color red, useful for debugging
|
|
Return position as [x,y]
|
|
move(x, y)
Move rect x pixels horizontally and y pixels vertically
|
|
moveTo(x, y)
Set rects x/y
|
|
resize(width, height)
Modify width and height
|
|
resizeTo(width, height)
Set width and height
|
|
shrink(x, y)
Shrink rectangle on both axis with given x/y values
|
Class Detail
jaws.Rect(x, y, width, height)
rect = new jaws.Rect(5,5,20,20) rect.right // -> 25 rect.bottom // -> 25 rect.move(10,20) rect.right // -> 35 rect.bottom // -> 45 rect.width // -> 20 rect.height // -> 20
- Parameters:
- x
- y
- width
- height
Method Detail
-
clone()Returns a new rect witht he same dimensions
-
collidePoint(x, y)Returns true if point at x, y lies within calling rect
- Parameters:
- x
- y
-
collideRect(rect)Returns true if calling rect overlaps with given rect in any way
- Parameters:
- rect
-
draw()Draw rect in color red, useful for debugging
-
getPosition()Return position as [x,y]
-
move(x, y)Move rect x pixels horizontally and y pixels vertically
- Parameters:
- x
- y
-
moveTo(x, y)Set rects x/y
- Parameters:
- x
- y
-
resize(width, height)Modify width and height
- Parameters:
- width
- height
-
resizeTo(width, height)Set width and height
- Parameters:
- width
- height
-
shrink(x, y)Shrink rectangle on both axis with given x/y values
- Parameters:
- x
- y