An Ellipse object.
This is a geometry object, containing numerical values and related methods to inspect and modify them. It is not a Game Object, in that you cannot add it to the display list, and it has no texture. To render an Ellipse you should look at the capabilities of the Graphics class.
new Ellipse([x], [y], [width], [height])
name | type | arguments | description |
---|---|---|---|
x | number | <optional> |
The x position of the center of the ellipse. |
y | number | <optional> |
The y position of the center of the ellipse. |
width | number | <optional> |
The width of the ellipse. |
height | number | <optional> |
The height of the ellipse. |
The bottom position of the Ellipse.
The height of the ellipse.
The left position of the Ellipse.
The right position of the Ellipse.
The top position of the Ellipse.
The geometry constant type of this object: GEOM_CONST.ELLIPSE
.
Used for fast type comparisons.
The width of the ellipse.
The x position of the center of the ellipse.
The y position of the center of the ellipse.
Check to see if the Ellipse contains the given x / y coordinates.
name | type | description |
---|---|---|
x | number |
The x coordinate to check within the ellipse. |
y | number |
The y coordinate to check within the ellipse. |
True if the coordinates are within the ellipse, otherwise false.
Returns the major radius of the ellipse. Also known as the Semi Major Axis.
The major radius.
Returns the minor radius of the ellipse. Also known as the Semi Minor Axis.
The minor radius.
Returns a Point object containing the coordinates of a point on the circumference of the Ellipse based on the given angle normalized to the range 0 to 1. I.e. a value of 0.5 will give the point at 180 degrees around the circle.
name | type | arguments | description |
---|---|---|---|
position | number |
A value between 0 and 1, where 0 equals 0 degrees, 0.5 equals 180 degrees and 1 equals 360 around the ellipse. |
|
out | object | Phaser.Geom.Point | <optional> |
An object to store the return values in. If not given a Point object will be created. |
A Point, or point-like object, containing the coordinates of the point around the ellipse.
Returns an array of Point objects containing the coordinates of the points around the circumference of the Ellipse, based on the given quantity or stepRate values.
name | type | arguments | description |
---|---|---|---|
quantity | number |
The amount of points to return. If a falsey value the quantity will be derived from the |
|
stepRate | number | <optional> |
Sets the quantity by getting the circumference of the ellipse and dividing it by the stepRate. |
output | array | Array.<Phaser.Geom.Point> | <optional> |
An array to insert the points in to. If not provided a new array will be created. |
An array of Point objects pertaining to the points around the circumference of the ellipse.
Returns a uniformly distributed random point from anywhere within the given Ellipse.
name | type | arguments | description |
---|---|---|---|
point | object | Phaser.Geom.Point | <optional> |
A Point or point-like object to set the random |
A Point object with the random values set in the x
and y
properties.
Checks to see if the Ellipse is empty: has a width or height equal to zero.
True if the Ellipse is empty, otherwise false.
Sets this Ellipse to be empty with a width and height of zero. Does not change its position.
This Ellipse object.
Sets the position of this Ellipse.
name | type | description |
---|---|---|
x | number |
The x position of the center of the ellipse. |
y | number |
The y position of the center of the ellipse. |
This Ellipse object.
Sets the size of this Ellipse. Does not change its position.
name | type | arguments | Default | description |
---|---|---|---|---|
width | number |
The width of the ellipse. |
||
height | number | <optional> | width |
The height of the ellipse. |
This Ellipse object.
Sets the x, y, width and height of this ellipse.
name | type | description |
---|---|---|
x | number |
The x position of the center of the ellipse. |
y | number |
The y position of the center of the ellipse. |
width | number |
The width of the ellipse. |
height | number |
The height of the ellipse. |
This Ellipse object.
Calculates the area of the Ellipse.
name | type | description |
---|---|---|
ellipse | Phaser.Geom.Ellipse |
The Ellipse to get the area of. |
The area of the Ellipse.
Returns the circumference of the given Ellipse.
name | type | description |
---|---|---|
ellipse | Phaser.Geom.Ellipse |
The Ellipse to get the circumference of. |
The circumference of th Ellipse.
Returns a Point object containing the coordinates of a point on the circumference of the Ellipse based on the given angle.
name | type | arguments | description |
---|---|---|---|
ellipse | Phaser.Geom.Ellipse |
The Ellipse to get the circumference point on. |
|
angle | number |
The angle from the center of the Ellipse to the circumference to return the point from. Given in radians. |
|
out | object | Phaser.Geom.Point | <optional> |
A Point, or point-like object, to store the results in. If not given a Point will be created. |
A Point object where the x
and y
properties are the point on the circumference.
Creates a new Ellipse instance based on the values contained in the given source.
name | type | description |
---|---|---|
source | Phaser.Geom.Ellipse |
The Ellipse to be cloned. Can be an instance of an Ellipse or a ellipse-like object, with x, y, width and height properties. |
A clone of the source Ellipse.
Check to see if the Ellipse contains the given x / y coordinates.
name | type | description |
---|---|---|
ellipse | Phaser.Geom.Ellipse |
The Ellipse to check. |
x | number |
The x coordinate to check within the ellipse. |
y | number |
The y coordinate to check within the ellipse. |
True if the coordinates are within the ellipse, otherwise false.
Check to see if the Ellipse contains the given Point object.
name | type | description |
---|---|---|
ellipse | Phaser.Geom.Ellipse |
The Ellipse to check. |
point | object | Phaser.Geom.Point |
The Point object to check if it's within the Circle or not. |
True if the Point coordinates are within the circle, otherwise false.
Check to see if the Ellipse contains all four points of the given Rectangle object.
name | type | description |
---|---|---|
ellipse | Phaser.Geom.Ellipse |
The Ellipse to check. |
rect | object | Phaser.Geom.Rectangle |
The Rectangle object to check if it's within the Ellipse or not. |
True if all of the Rectangle coordinates are within the ellipse, otherwise false.
Copies the x
, y
, width
and height
properties from the source
Ellipse
into the given dest
Ellipse, then returns the dest
Ellipse.
name | type | description |
---|---|---|
source | Phaser.Geom.Ellipse |
The source Ellipse to copy the values from. |
dest | Phaser.Geom.Ellipse |
The destination Ellipse to copy the values to. |
The destination Ellipse.
Compares the x
, y
, width
and height
properties of the two given Ellipses.
Returns true
if they all match, otherwise returns false
.
name | type | description |
---|---|---|
ellipse | Phaser.Geom.Ellipse |
The first Ellipse to compare. |
toCompare | Phaser.Geom.Ellipse |
The second Ellipse to compare. |
true
if the two Ellipse equal each other, otherwise false
.
Returns the bounds of the Ellipse object.
name | type | arguments | description |
---|---|---|---|
ellipse | Phaser.Geom.Ellipse |
The Ellipse to get the bounds from. |
|
out | object | Phaser.Geom.Rectangle | <optional> |
A Rectangle, or rectangle-like object, to store the ellipse bounds in. If not given a new Rectangle will be created. |
The Rectangle object containing the Ellipse bounds.
Returns a Point object containing the coordinates of a point on the circumference of the Ellipse based on the given angle normalized to the range 0 to 1. I.e. a value of 0.5 will give the point at 180 degrees around the circle.
name | type | arguments | description |
---|---|---|---|
ellipse | Phaser.Geom.Ellipse |
The Ellipse to get the circumference point on. |
|
position | number |
A value between 0 and 1, where 0 equals 0 degrees, 0.5 equals 180 degrees and 1 equals 360 around the ellipse. |
|
out | object | Phaser.Geom.Point | <optional> |
An object to store the return values in. If not given a Point object will be created. |
A Point, or point-like object, containing the coordinates of the point around the ellipse.
Returns an array of Point objects containing the coordinates of the points around the circumference of the Ellipse, based on the given quantity or stepRate values.
name | type | arguments | description |
---|---|---|---|
ellipse | Phaser.Geom.Ellipse |
The Ellipse to get the points from. |
|
quantity | number |
The amount of points to return. If a falsey value the quantity will be derived from the |
|
stepRate | number | <optional> |
Sets the quantity by getting the circumference of the ellipse and dividing it by the stepRate. |
out | array | Array.<Phaser.Geom.Point> | <optional> |
An array to insert the points in to. If not provided a new array will be created. |
An array of Point objects pertaining to the points around the circumference of the ellipse.
Offsets the Ellipse by the values given.
name | type | description |
---|---|---|
ellipse | Phaser.Geom.Ellipse |
The Ellipse to be offset (translated.) |
x | number |
The amount to horizontally offset the Ellipse by. |
y | number |
The amount to vertically offset the Ellipse by. |
The Ellipse that was offset.
Offsets the Ellipse by the values given in the x
and y
properties of the Point object.
name | type | description |
---|---|---|
ellipse | Phaser.Geom.Ellipse |
The Ellipse to be offset (translated.) |
point | object | Phaser.Geom.Point |
The Point object containing the values to offset the Ellipse by. |
The Ellipse that was offset.
Returns a uniformly distributed random point from anywhere within the given Ellipse.
name | type | arguments | description |
---|---|---|---|
ellipse | Phaser.Geom.Ellipse |
The Ellipse to get a random point from. |
|
out | object | Phaser.Geom.Point | <optional> |
A Point or point-like object to set the random |
A Point object with the random values set in the x
and y
properties.