Constructor
new Frame(fxopt, fyopt, fwopt, fhopt, cxopt, cyopt, cwopt, chopt)
Creates a new Frame object.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
fx |
number |
<optional> |
0 | Frame x. |
fy |
number |
<optional> |
0 | Frame y. |
fw |
number |
<optional> |
0 | Frame width. |
fh |
number |
<optional> |
0 | Frame height. |
cx |
number |
<optional> |
0 | Clipping x |
cy |
number |
<optional> |
0 | Clipping y |
cw |
number |
<optional> |
0 | Clipping width. |
ch |
number |
<optional> |
0 | Clipping height. |
- Source:
Extends
Members
bottom :number
The sum of the y and height properties.
Type:
- number
- Inherited From:
- Source:
bottomLeft :rune.geom.Rectangle
The location of the Rectangle object's bottom-left corner, determined by the
values of the left and bottom properties.
Type:
- Inherited From:
- Source:
bottomRight :rune.geom.Rectangle
The location of the Rectangle object's bottom-right corner, determined by the
values of the right and bottom properties.
Type:
- Inherited From:
- Source:
center :rune.geom.Point
The center point of the rectangle object.
Type:
- Inherited From:
- Source:
centerX :number
The x coordinate of the center of the object.
Type:
- number
- Inherited From:
- Source:
centerY :number
The y coordinate of the center of the object.
Type:
- number
- Inherited From:
- Source:
(readonly) clipping :rune.geom.Rectangle
Clipping data.
Type:
- Source:
height :number
The height of the rectangle, in pixels.
Type:
- number
- Inherited From:
- Source:
left :number
The x coordinate of the top-left corner of the rectangle.
Type:
- number
- Inherited From:
- Source:
right :number
The sum of the x and width properties.
Type:
- number
- Inherited From:
- Source:
size :rune.geom.Point
The size of the Rectangle object, expressed as a Point object with the values
of the width and height properties.
Type:
- Inherited From:
- Source:
top :number
The y coordinate of the top-left corner of the rectangle.
Type:
- number
- Inherited From:
- Source:
topLeft :rune.geom.Point
The location of the Rectangle object's top-left corner, determined by the x
and y coordinates of the point.
Type:
- Inherited From:
- Source:
topRight :rune.geom.Point
The location of the Rectangle object's top-right corner, determined by the x
and y coordinates of the point.
Type:
- Inherited From:
- Source:
width :number
The width of the rectangle, in pixels.
Type:
- number
- Inherited From:
- Source:
x :number
The horizontal coordinate of the point. The default value is 0.
Type:
- number
- Inherited From:
- Source:
y :number
The vertical coordinate of the point. The default value is 0.
Type:
- number
- Inherited From:
- Source:
Methods
angleTo(target) → {number}
Returns the direction from this point to a target in radians, between -pi
and pi. Zero points along positive x. With screen coordinates, positive
angles turn toward positive y. Neither point is modified.
Returns zero when both points have the same coordinates.
Parameters:
| Name | Type | Description |
|---|---|---|
target |
rune.geom.Point | Target point. |
- Inherited From:
- Source:
Returns:
Direction to the target in radians.
- Type
- number
containsPoint(point) → {boolean}
Determines whether the specified point is contained within the rectangular
region defined by this Rectangle object.
Parameters:
| Name | Type | Description |
|---|---|---|
point |
rune.geom.Point | The point, as represented by its x and y coordinates. |
- Inherited From:
- Source:
Returns:
A value of true if the Rectangle object contains the specified point; otherwise false.
- Type
- boolean
containsRectangle(rect) → {boolean}
Determines whether the Rectangle object specified by the rect parameter is
contained within this Rectangle object. A Rectangle object is said to contain
another if the second Rectangle object falls entirely within the boundaries
of the first.
Parameters:
| Name | Type | Description |
|---|---|---|
rect |
rune.geom.Rectangle | The Rectangle object being checked. |
- Inherited From:
- Source:
Returns:
A value of true if the Rectangle object that you specify is contained by this Rectangle object; otherwise false.
- Type
- boolean
copyFrom(point) → {rune.geom.Point}
Copies the coordinates of the specified point to this point.
Parameters:
| Name | Type | Description |
|---|---|---|
point |
rune.geom.Point | The point to copy coordinates from. |
- Inherited From:
- Source:
Returns:
This point.
- Type
- rune.geom.Point
distance(point) → {number}
Returns the distance between the current and specified point.
Parameters:
| Name | Type | Description |
|---|---|---|
point |
rune.geom.Point | The specified point. |
- Inherited From:
- Source:
Returns:
- Type
- number
distanceSquared(point) → {number}
Returns the squared distance between the current and specified point without
calculating a square root. Compare the result against a squared distance.
Parameters:
| Name | Type | Description |
|---|---|---|
point |
rune.geom.Point | The specified point. |
- Inherited From:
- Source:
Returns:
The squared distance between the points.
- Type
- number
getCenter(outputopt) → {rune.geom.Point}
Returns the exact geometric center of this rectangle without rounding.
Supply an output point to reuse an existing object instead of creating one.
Unlike the center property, fractional coordinates are preserved.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
output |
rune.geom.Point |
<optional> |
The point to store the center coordinates in. |
- Inherited From:
- Source:
Returns:
The point containing the center coordinates.
- Type
- rune.geom.Point
inflate(dx, dy) → {rune.geom.Rectangle}
Expands this rectangle by dx on both horizontal sides and dy on both vertical
sides, preserving its geometric center. Negative values shrink the rectangle.
Width and height are not clamped and may become negative if the rectangle is
shrunk beyond its current size.
Parameters:
| Name | Type | Description |
|---|---|---|
dx |
number | The amount to add to each horizontal side. |
dy |
number | The amount to add to each vertical side. |
- Inherited From:
- Source:
Returns:
This rectangle.
- Type
- rune.geom.Rectangle
interpolate(point, fractionopt, outputopt) → {rune.geom.Point}
Determines a point between two specified points. The parameter fraction
determines where the new interpolated point is located relative to the two
end points.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
point |
rune.geom.Point | The second point. | |
fraction |
number |
<optional> |
The level of interpolation between the two points. |
output |
rune.geom.Point |
<optional> |
Save results to this object. |
- Inherited From:
- Source:
Returns:
The new, interpolated point.
- Type
- rune.geom.Point
intersection(toIntersect, outputopt) → {rune.geom.Rectangle}
If the Rectangle object specified in the toIntersect parameter intersects
with this Rectangle object, returns the area of intersection as a Rectangle
object. If the rectangles do not intersect, this method returns an empty
Rectangle object with its properties set to 0.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
toIntersect |
rune.geom.Rectangle | The Rectangle object to compare against to see if it intersects with this Rectangle object. | |
output |
rune.geom.Rectangle |
<optional> |
A Rectangle object to store the intersection results in. |
- Inherited From:
- Source:
Returns:
A Rectangle object that equals the area of intersection.
- Type
- rune.geom.Rectangle
intersects(toIntersect) → {boolean}
Determines whether the specified rectangle overlaps this rectangle with
positive area. Edge and corner contact and empty rectangles return false.
Parameters:
| Name | Type | Description |
|---|---|---|
toIntersect |
rune.geom.Rectangle | The Rectangle object to compare against this Rectangle object. |
- Inherited From:
- Source:
Returns:
A value of true if the specified object intersects with this Rectangle object; otherwise false.
- Type
- boolean
moveTowards(target, distance) → {rune.geom.Point}
Moves this point toward a target by at most the specified distance without
passing it. The target is not modified. A distance of zero or less leaves
this point unchanged. All coordinates and the distance use the same units.
Parameters:
| Name | Type | Description |
|---|---|---|
target |
rune.geom.Point | Target point. |
distance |
number | Maximum distance to move for this call. |
- Inherited From:
- Source:
Returns:
This point.
- Type
- rune.geom.Point
set(x, y) → {rune.geom.Point}
Sets the horizontal and vertical coordinates of this point.
Parameters:
| Name | Type | Description |
|---|---|---|
x |
number | The horizontal coordinate. |
y |
number | The vertical coordinate. |
- Inherited From:
- Source:
Returns:
This point.
- Type
- rune.geom.Point
toString() → {string}
Returns a string representation of the hitbox. Useful for troubleshooting.
- Overrides:
- Source:
Returns:
- Type
- string
union(rect, outputopt) → {rune.geom.Rectangle}
Returns the smallest rectangle that contains this rectangle and the specified
rectangle, including any space between them. The original rectangles remain
unchanged unless one is supplied as output. Zero-sized rectangles contribute
their coordinates to the bounds.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
rect |
rune.geom.Rectangle | The rectangle to combine with this rectangle. | |
output |
rune.geom.Rectangle |
<optional> |
Store results in this object. May be either input rectangle. |
- Inherited From:
- Source:
Returns:
The rectangle enclosing both rectangles.
- Type
- rune.geom.Rectangle