Class: Ellipse

Phaser. Ellipse

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.

y number <optional>
0

The Y coordinate of the upper-left corner of the framing rectangle of this ellipse.

width number <optional>
0

The overall width of this ellipse.

height number <optional>
0

The overall height of this ellipse.

Source:
src/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.

Type:
  • number
Source:
src/geom/Ellipse.js line 244

<readonly> centerX : number

The x coordinate of the center of the Ellipse.

Type:
  • number
Source:
src/geom/Ellipse.js line 270

<readonly> centerY : number

The y coordinate of the center of the Ellipse.

Type:
  • number
Source:
src/geom/Ellipse.js line 285

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.

Type:
  • boolean
Source:
src/geom/Ellipse.js line 300

height : number

The overall height of this ellipse.

Type:
  • number
Source:
src/geom/Ellipse.js line 43

left

The left coordinate of the Ellipse. The same as the X coordinate.

Source:
src/geom/Ellipse.js line 180

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.

Type:
  • number
Source:
src/geom/Ellipse.js line 199

top : number

The top of the Ellipse. The same as its y property. Gets or sets the top of the ellipse.

Type:
  • number
Source:
src/geom/Ellipse.js line 225

<readonly> type : number

The const type of this object.

Type:
  • number
Source:
src/geom/Ellipse.js line 49

width : number

The overall width of this ellipse.

Type:
  • number
Source:
src/geom/Ellipse.js line 38

x : number

The X coordinate of the upper-left corner of the framing rectangle of this ellipse.

Type:
  • number
Source:
src/geom/Ellipse.js line 28

y : number

The Y coordinate of the upper-left corner of the framing rectangle of this ellipse.

Type:
  • number
Source:
src/geom/Ellipse.js line 33

Methods

<static> contains(a, x, y)

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.

Source:
src/geom/Ellipse.js line 323
Returns:

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

Type
boolean

<static> intersectsLine(e, l [, returnPoints])

Checks if the given Ellipse and Line objects intersect.

Parameters:
Name Type Argument Description
e Phaser.Ellipse

The Ellipse object to test.

l Phaser.Line

The Line object to test.

returnPoints boolean <optional>

optional Array Object, Return an array of intersection points if true, otherwise return boolean.

Source:
src/geom/Ellipse.js line 349
Returns:

True if the two objects intersect, otherwise false.

Type
boolean

clone( [output])

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

Parameters:
Name Type Argument Description
output Phaser.Ellipse <optional>

Optional Ellipse object. If given the values will be set into the object, otherwise a brand new Ellipse object will be created and returned.

Source:
src/geom/Ellipse.js line 112
Returns:

The cloned Ellipse object.

Type
Phaser.Ellipse

contains(x, y)

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.

Source:
src/geom/Ellipse.js line 132
Returns:

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

Type
boolean

copyFrom(source)

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.

Source:
src/geom/Ellipse.js line 84
Returns:

This Ellipse object.

Type
Phaser.Ellipse

copyTo(dest)

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.

Source:
src/geom/Ellipse.js line 96
Returns:

This dest object.

Type
object

getBounds()

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

Source:
src/geom/Ellipse.js line 73
Returns:

The bounds of the Ellipse.

Type
Phaser.Rectangle

random( [out])

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.

Source:
src/geom/Ellipse.js line 145
Returns:

An object containing the random point in its x and y properties.

Type
Phaser.Point

setTo(x, y, width, height)

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.

Source:
src/geom/Ellipse.js line 54
Returns:

This Ellipse object.

Type
Phaser.Ellipse

toString()

Returns a string representation of this object.

Source:
src/geom/Ellipse.js line 166
Returns:

A string representation of the instance.

Type
string

phaser-ce@2.20.0 is on GitHub and NPM

Documentation generated by JSDoc 3.6.7 on 2022-12-10 using Tomorrow.