new Ellipse ( x, y, width, height)
Creates a Ellipse object. A curve on a plane surrounding two focal points.
创建椭圆对象。围绕两个焦点的平面上的曲线。Parameters:
Name | Type | Argument | Default | Description |
---|---|---|---|---|
x |
number | <optional>
|
0 |
The X coordinate of the upper-left corner of the framing rectangle of this ellipse. 此椭圆框架矩形左上角的X坐标。 |
y |
number | <optional>
|
0 |
The Y coordinate of the upper-left corner of the framing rectangle of this ellipse. 此椭圆框架矩形左上角的Y坐标。 |
width |
number | <optional>
|
0 |
The overall width of this ellipse. 椭圆的总宽度。 |
height |
number | <optional>
|
0 |
The overall height of this ellipse. 这个椭圆的总高度。 |
- Source - geom/Ellipse.js, line 18
Members
-
bottom :number
-
The sum of the y and height properties. Changing the bottom property of an Ellipse doesn't adjust the y property, but does change the height. Gets or sets the bottom of the ellipse.
Y和高度属性的总和。更改椭圆的底部属性不会调整Y属性,但会更改高度。获取或设置椭圆的底部。- Source - geom/Ellipse.js, line 251
-
empty :boolean
-
Determines whether or not this Ellipse object is empty. Will return a value of true if the Ellipse objects dimensions are less than or equal to 0; otherwise false. If set to true it will reset all of the Ellipse objects properties to 0. An Ellipse object is empty if its width or height is less than or equal to 0. Gets or sets the empty state of the ellipse.
确定此椭圆对象是否为空。如果椭圆对象的尺寸小于或等于0,则返回值“真”;否则返回值“假”。如果设置为真,它将把所有椭圆对象属性重置为0。如果椭圆对象的宽度或高度小于或等于0,则该椭圆对象为空。获取或设置椭圆的空状态。- Source - geom/Ellipse.js, line 276
-
height :number
-
The overall height of this ellipse.
The overall height of this ellipse.- Source - geom/Ellipse.js, line 43
-
left
-
The left coordinate of the Ellipse. The same as the X coordinate.
- Source - geom/Ellipse.js, line 190
-
right :number
-
The x coordinate of the rightmost point of the Ellipse. Changing the right property of an Ellipse object has no effect on the x property, but does adjust the width. Gets or sets the value of the rightmost point of the ellipse.
- Source - geom/Ellipse.js, line 209
-
top :number
-
The top of the Ellipse. The same as its y property. Gets or sets the top of the ellipse.
- Source - geom/Ellipse.js, line 234
-
<readonly>type :number
-
The const type of this object.
- Source - geom/Ellipse.js, line 49
-
width :number
-
The overall width of this ellipse.
- Source - geom/Ellipse.js, line 38
-
x :number
-
The X coordinate of the upper-left corner of the framing rectangle of this ellipse.
- Source - geom/Ellipse.js, line 28
-
y :number
-
The Y coordinate of the upper-left corner of the framing rectangle of this ellipse.
- Source - geom/Ellipse.js, line 33
Methods
-
<static>contains (a, x, y) → {boolean}
-
Return true if the given x/y coordinates are within the Ellipse object.
Parameters:
Name Type Description a
Phaser.Ellipse The Ellipse 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 ellipse, otherwise false.
- Source - geom/Ellipse.js, line 299
-
clone (output) → { Phaser.Ellipse}
-
Returns a new Ellipse object with the same values for the x, y, width, and height properties as this Ellipse object.
Parameters:
Name Type Description output
Phaser.Ellipse Optional Ellipse object. If given the values will be set into the object, otherwise a brand new Ellipse object will be created and returned.
Returns:
The cloned Ellipse object.
- Source - geom/Ellipse.js, line 117
-
contains (x, y) → {boolean}
-
Return true if the given x/y coordinates are within this Ellipse 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 ellipse, otherwise false.
- Source - geom/Ellipse.js, line 138
-
copyFrom (source) → { Phaser.Ellipse}
-
Copies the x, y, width and height properties from any given object to this Ellipse.
Parameters:
Name Type Description source
any The object to copy from.
Returns:
This Ellipse object.
- Source - geom/Ellipse.js, line 87
-
copyTo (dest) → {object}
-
Copies the x, y, width and height properties from this Ellipse to any given object.
Parameters:
Name Type Description dest
any The object to copy to.
Returns:
object-This dest object.
- Source - geom/Ellipse.js, line 100
-
getBounds () → { Phaser.Rectangle}
-
Returns the framing rectangle of the ellipse as a Phaser.Rectangle object.
Returns:
The bounds of the Ellipse.
- Source - geom/Ellipse.js, line 75
-
random ( out) → { Phaser.Point}
-
Returns a uniformly distributed random point from anywhere within this Ellipse.
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
x
andy
properties.- Source - geom/Ellipse.js, line 152
-
setTo (x, y, width, height) → { Phaser.Ellipse}
-
Sets the members of the Ellipse to the specified values.
Parameters:
Name Type Description x
number The X coordinate of the upper-left corner of the framing rectangle of this ellipse.
y
number The Y coordinate of the upper-left corner of the framing rectangle of this ellipse.
width
number The overall width of this ellipse.
height
number The overall height of this ellipse.
Returns:
This Ellipse object.
- Source - geom/Ellipse.js, line 55
-
toString () → {string}
-
Returns a string representation of this object.
Returns:
string-A string representation of the instance.
- Source - geom/Ellipse.js, line 177