Creates a new Circle object with the center coordinate specified by the x and y parameters and the diameter specified by the diameter parameter.
If you call this function without parameters, a circle with x, y, diameter and radius properties set to 0 is created.
Name | Type | Argument | Default | Description |
---|---|---|---|---|
x | number | <optional> | 0 | The x coordinate of the center of the circle. |
y | number | <optional> | 0 | The y coordinate of the center of the circle. |
diameter | number | <optional> | 0 | The diameter of the circle. |
The area of this Circle.
The sum of the y and radius properties. Changing the bottom property of a Circle object has no effect on the x and y properties, but does change the diameter. Gets or sets the bottom of the circle.
The largest distance between any two points on the circle. The same as the radius * 2. Gets or sets the diameter of the circle.
Determines whether or not this Circle object is empty. Will return a value of true if the Circle objects diameter is less than or equal to 0; otherwise false.
If set to true it will reset all of the Circle objects properties to 0. A Circle object is empty if its diameter is less than or equal to 0. Gets or sets the empty state of the circle.
The x coordinate of the leftmost point of the circle. Changing the left property of a Circle object has no effect on the x and y properties. However it does affect the diameter, whereas changing the x value does not affect the diameter property.
The length of a line extending from the center of the circle to any point on the circle itself. The same as half the diameter. Gets or sets the radius of the circle.
The x coordinate of the rightmost point of the circle. Changing the right property of a Circle object has no effect on the x and y properties. However it does affect the diameter, whereas changing the x value does not affect the diameter property. Gets or sets the value of the rightmost point of the circle.
The sum of the y minus the radius property. Changing the top property of a Circle object has no effect on the x and y properties, but does change the diameter. Gets or sets the top of the circle.
The const type of this object.
The x coordinate of the center of the circle.
The y coordinate of the center of the circle.
Returns a Point object containing the coordinates of a point on the circumference of the Circle based on the given angle.
Name | Type | Argument | Default | Description |
---|---|---|---|---|
a | Phaser.Circle | The first Circle object. | ||
angle | number | The angle in radians (unless asDegrees is true) to return the point from. | ||
asDegrees | boolean | <optional> | false | Is the given angle in radians (false) or degrees (true)? |
out | Phaser.Point | <optional> | An optional Point object to put the result in to. If none specified a new Point object will be created. |
The Point object holding the result.
Return true if the given x/y coordinates are within the Circle object.
Name | Type | Description |
---|---|---|
a | Phaser.Circle | The Circle to be checked. |
x | number | The X value of the coordinate to test. |
y | number | The Y value of the coordinate to test. |
True if the coordinates are within this circle, otherwise false.
Determines whether the two Circle objects match. This method compares the x, y and diameter properties.
Name | Type | Description |
---|---|---|
a | Phaser.Circle | The first Circle object. |
b | Phaser.Circle | The second Circle object. |
A value of true if the object has exactly the same values for the x, y and diameter properties as this Circle object; otherwise false.
Determines whether the two Circle objects intersect.
This method checks the radius distances between the two Circle objects to see if they intersect.
Name | Type | Description |
---|---|---|
a | Phaser.Circle | The first Circle object. |
b | Phaser.Circle | The second Circle object. |
A value of true if the specified object intersects with this Circle object; otherwise false.
Checks if the given Circle and Rectangle objects intersect.
Name | Type | Description |
---|---|---|
c | Phaser.Circle | The Circle object to test. |
r | Phaser.Rectangle | The Rectangle object to test. |
True if the two objects intersect, otherwise false.
The circumference of the circle.
The circumference of the circle.
Returns a Point object containing the coordinates of a point on the circumference of the Circle based on the given angle.
Name | Type | Argument | Default | Description |
---|---|---|---|---|
angle | number | The angle in radians (unless asDegrees is true) to return the point from. | ||
asDegrees | boolean | <optional> | false | Is the given angle in radians (false) or degrees (true)? |
out | Phaser.Point | <optional> | An optional Point object to put the result in to. If none specified a new Point object will be created. |
The Point object holding the result.
Returns a new Circle object with the same values for the x, y, width, and height properties as this Circle object.
Name | Type | Description |
---|---|---|
output | Phaser.Circle | Optional Circle object. If given the values will be set into the object, otherwise a brand new Circle object will be created and returned. |
The cloned Circle object.
Return true if the given x/y coordinates are within this Circle object.
Name | Type | Description |
---|---|---|
x | number | The X value of the coordinate to test. |
y | number | The Y value of the coordinate to test. |
True if the coordinates are within this circle, otherwise false.
Copies the x, y and diameter properties from any given object to this Circle.
Name | Type | Description |
---|---|---|
source | any | The object to copy from. |
This Circle object.
Copies the x, y and diameter properties from this Circle to any given object.
Name | Type | Description |
---|---|---|
dest | any | The object to copy to. |
This dest object.
Returns the distance from the center of the Circle object to the given object
(can be Circle, Point or anything with x/y properties)
Name | Type | Argument | Default | Description |
---|---|---|---|---|
dest | object | The target object. Must have visible x and y properties that represent the center of the object. | ||
round | boolean | <optional> | false | Round the distance to the nearest integer. |
The distance between this Point object and the destination Point object.
Returns the framing rectangle of the circle as a Phaser.Rectangle object.
The bounds of the Circle.
Adjusts the location of the Circle object, as determined by its center coordinate, by the specified amounts.
Name | Type | Description |
---|---|---|
dx | number | Moves the x value of the Circle object by this amount. |
dy | number | Moves the y value of the Circle object by this amount. |
This Circle object.
Adjusts the location of the Circle object using a Point object as a parameter. This method is similar to the Circle.offset() method, except that it takes a Point object as a parameter.
Name | Type | Description |
---|---|---|
point | Point | A Point object to use to offset this Circle object (or any valid object with exposed x and y properties). |
This Circle object.
Returns a uniformly distributed random point from anywhere within this Circle.
Name | Type | Argument | Description |
---|---|---|---|
out | Phaser.Point | object | <optional> | A Phaser.Point, or any object with public x/y properties, that the values will be set in. |
An object containing the random point in its x
and y
properties.
Sets the members of Circle to the specified values.
Name | Type | Description |
---|---|---|
x | number | The x coordinate of the center of the circle. |
y | number | The y coordinate of the center of the circle. |
diameter | number | The diameter of the circle. |
This circle object.
Returns a string representation of this object.
a string representation of the instance.
© 2016 Richard Davey, Photon Storm Ltd.
Licensed under the MIT License.
http://phaser.io/docs/2.6.2/Phaser.Circle.html