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 263

<readonly> centerX : number

The x coordinate of the center of the Ellipse.

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

<readonly> centerY : number

The y coordinate of the center of the Ellipse.

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

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 320

height : number

The overall height of this ellipse.

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

left

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

Source:
src/geom/Ellipse.js line 196

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 217

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 244

<readonly> type : number

The const type of this object.

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

width : number

The overall width of this ellipse.

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

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 29

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 34

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 345
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 373
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 122
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 144
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 90
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 104
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 77
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 159
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 56
Returns:

This Ellipse object.

Type
Phaser.Ellipse

toString()

Returns a string representation of this object.

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

A string representation of the instance.

Type
string

phaser-ce@2.11.0 is on GitHub and NPM

Documentation generated by JSDoc 3.5.4 on 2018-06-26 using Tomorrow.