Phaser.Circle

new Circle ( x, y, diameter)

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.

使用X和Y参数指定的中心坐标和直径参数指定的直径创建新的圆形对象。 如果在不带参数的情况下调用此函数,将创建一个X、Y、直径和半径属性设置为0的圆。
Parameters:
Name Type Argument Default Description
x number <optional>
0

The x coordinate of the center of the circle.

圆心的X坐标。
y number <optional>
0

The y coordinate of the center of the circle.

圆心的Y坐标。
diameter number <optional>
0

The diameter of the circle.

圆的直径。
Source - geom/Circle.js, line 17

Members

<readonly>area :number

The area of this Circle.

Source - geom/Circle.js, line 412

bottom :number

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.

Y和半径属性的总和。更改圆对象的底部属性对X和Y属性没有影响,但会更改直径。获取或设置圆的底端。
Source - geom/Circle.js, line 385

diameter :number

The largest distance between any two points on the circle. The same as the radius * 2. Gets or sets the diameter of the circle.

圆上任意两点之间的最大距离。与半径*2相同。获取或设置圆的直径。
Source - geom/Circle.js, line 258

empty :boolean

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.

确定此圆对象是否为空。如果圆对象直径小于或等于0,则返回值“真”;否则返回值“假”。如果设置为真,它会将所有圆对象属性重置为0。如果圆形对象的直径小于或等于0,则该对象为空。获取或设置圆的空状态。
Source - geom/Circle.js, line 435

left

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.

圆最左边点的X坐标。更改圆对象的左属性对X和Y属性没有影响。但是,它会影响直径,而更改X值不会影响直径属性。
Source - geom/Circle.js, line 304

radius :number

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.

Source - geom/Circle.js, line 281

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.

Source - geom/Circle.js, line 331

top :number

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.

Source - geom/Circle.js, line 358

<readonly>type :number

The const type of this object.

Source - geom/Circle.js, line 54

x :number

The x coordinate of the center of the circle.

Source - geom/Circle.js, line 26

y :number

The y coordinate of the center of the circle.

Source - geom/Circle.js, line 31

Methods

<static>circumferencePoint (a, angle, asDegrees, out) → { Phaser.Point}

Returns a Point object containing the coordinates of a point on the circumference of the Circle based on the given angle.

Parameters:
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.

Returns:

The Point object holding the result.

Source - geom/Circle.js, line 506

<static>contains (a, x, y) → {boolean}

Return true if the given x/y coordinates are within the Circle object.

Parameters:
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.

Returns:
boolean-

True if the coordinates are within this circle, otherwise false.

Source - geom/Circle.js, line 458

<static>equals (a, b) → {boolean}

Determines whether the two Circle objects match. This method compares the x, y and diameter properties.

Parameters:
Name Type Description
a Phaser.Circle

The first Circle object.

b Phaser.Circle

The second Circle object.

Returns:
boolean-

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.

Source - geom/Circle.js, line 483

<static>intersects (a, b) → {boolean}

Determines whether the two Circle objects intersect. This method checks the radius distances between the two Circle objects to see if they intersect.

Parameters:
Name Type Description
a Phaser.Circle

The first Circle object.

b Phaser.Circle

The second Circle object.

Returns:
boolean-

A value of true if the specified object intersects with this Circle object; otherwise false.

Source - geom/Circle.js, line 494

<static>intersectsRectangle (c, r) → {boolean}

Checks if the given Circle and Rectangle objects intersect.

Parameters:
Name Type Description
c Phaser.Circle

The Circle object to test.

r Phaser.Rectangle

The Rectangle object to test.

Returns:
boolean-

True if the two objects intersect, otherwise false.

Source - geom/Circle.js, line 532

circumference () → {number}

The circumference of the circle.

Returns:
number-

The circumference of the circle.

Source - geom/Circle.js, line 60

circumferencePoint (angle, asDegrees, out) → { Phaser.Point}

Returns a Point object containing the coordinates of a point on the circumference of the Circle based on the given angle.

Parameters:
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.

Returns:

The Point object holding the result.

Source - geom/Circle.js, line 205

clone (output) → { Phaser.Circle}

Returns a new Circle object with the same values for the x, y, width, and height properties as this Circle object.

Parameters:
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.

Returns:

The cloned Circle object.

Source - geom/Circle.js, line 171

contains (x, y) → {boolean}

Return true if the given x/y coordinates are within this Circle object.

Parameters:
Name Type Description
x number

The X value of the coordinate to test.

y number

The Y value of the coordinate to test.

Returns:
boolean-

True if the coordinates are within this circle, otherwise false.

Source - geom/Circle.js, line 192

copyFrom (source) → {Circle}

Copies the x, y and diameter properties from any given object to this Circle.

Parameters:
Name Type Description
source any

The object to copy from.

Returns:
Circle-

This Circle object.

Source - geom/Circle.js, line 128

copyTo (dest) → {object}

Copies the x, y and diameter properties from this Circle to any given object.

Parameters:
Name Type Description
dest any

The object to copy to.

Returns:
object-

This dest object.

Source - geom/Circle.js, line 140

distance (dest, round) → {number}

Returns the distance from the center of the Circle object to the given object (can be Circle, Point or anything with x/y properties)

Parameters:
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.

Returns:
number-

The distance between this Point object and the destination Point object.

Source - geom/Circle.js, line 156

getBounds () → { Phaser.Rectangle}

Returns the framing rectangle of the circle as a Phaser.Rectangle object.

Returns:

The bounds of the Circle.

Source - geom/Circle.js, line 97

offset (dx, dy) → {Circle}

Adjusts the location of the Circle object, as determined by its center coordinate, by the specified amounts.

Parameters:
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.

Returns:
Circle-

This Circle object.

Source - geom/Circle.js, line 219

offsetPoint (point) → {Circle}

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.

Parameters:
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).

Returns:
Circle-

This Circle object.

Source - geom/Circle.js, line 235

random ( out) → { Phaser.Point}

Returns a uniformly distributed random point from anywhere within this Circle.

Parameters:
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. If no object is provided a new Phaser.Point object will be created. In high performance areas avoid this by re-using an existing object.

Returns:

An object containing the random point in its xand yproperties.

Source - geom/Circle.js, line 72

setTo (x, y, diameter) → {Circle}

Sets the members of Circle to the specified values.

Parameters:
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.

Returns:
Circle-

This circle object.

Source - geom/Circle.js, line 109

toString () → {string}

Returns a string representation of this object.

Returns:
string-

a string representation of the instance.

Source - geom/Circle.js, line 245
Phaser Copyright © 2012-2015 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.2on Thu Feb 18 2016 14:40:59 GMT+0000 (GMT Standard Time) using the DocStrap template.