phaser - v4.0.0-rc.4
    Preparing search index...

    An Ellipse object.

    This is a geometry object, containing numerical values and related methods to inspect and modify them. It is not a Game Object, in that you cannot add it to the display list, and it has no texture. To render an Ellipse you should look at the capabilities of the Graphics class.

    Index

    Constructors

    • Parameters

      • Optionalx: number

        The x position of the center of the ellipse. Default 0.

      • Optionaly: number

        The y position of the center of the ellipse. Default 0.

      • Optionalwidth: number

        The width of the ellipse. Default 0.

      • Optionalheight: number

        The height of the ellipse. Default 0.

      Returns Geom.Ellipse

    Properties

    bottom: number

    The bottom position of the Ellipse.

    height: number

    The height of the ellipse.

    left: number

    The left position of the Ellipse.

    right: number

    The right position of the Ellipse.

    top: number

    The top position of the Ellipse.

    type: number

    The geometry constant type of this object: GEOM_CONST.ELLIPSE. Used for fast type comparisons.

    width: number

    The width of the ellipse.

    x: number

    The x position of the center of the ellipse.

    y: number

    The y position of the center of the ellipse.

    Methods

    • Check to see if the Ellipse contains the given x / y coordinates.

      Parameters

      • x: number

        The x coordinate to check within the ellipse.

      • y: number

        The y coordinate to check within the ellipse.

      Returns boolean

    • Returns the major radius of the ellipse. Also known as the Semi Major Axis.

      Returns number

    • Returns the minor radius of the ellipse. Also known as the Semi Minor Axis.

      Returns number

    • Returns a Point object containing the coordinates of a point on the circumference of the Ellipse based on the given angle normalized to the range 0 to 1. I.e. a value of 0.5 will give the point at 180 degrees around the circle.

      Type Parameters

      Parameters

      • position: number

        A value between 0 and 1, where 0 equals 0 degrees, 0.5 equals 180 degrees and 1 equals 360 around the ellipse.

      • Optionalout: O

        A Vector2 to store the return values in. If not given a Vector2 object will be created.

      Returns O

    • Returns an array of Vector2 objects containing the coordinates of the points around the circumference of the Ellipse, based on the given quantity or stepRate values.

      Type Parameters

      Parameters

      • quantity: number

        The amount of points to return. If a falsey value the quantity will be derived from the stepRate instead.

      • OptionalstepRate: number

        Sets the quantity by getting the circumference of the ellipse and dividing it by the stepRate.

      • Optionaloutput: O

        An array to insert the Vector2s in. If not provided a new array will be created.

      Returns O

    • Checks to see if the Ellipse is empty: has a width or height equal to zero.

      Returns boolean

    • Sets this Ellipse to be empty with a width and height of zero. Does not change its position.

      Returns this

    • Sets the position of this Ellipse.

      Parameters

      • x: number

        The x position of the center of the ellipse.

      • y: number

        The y position of the center of the ellipse.

      Returns this

    • Sets the size of this Ellipse. Does not change its position.

      Parameters

      • width: number

        The width of the ellipse.

      • Optionalheight: number

        The height of the ellipse. Default width.

      Returns this

    • Sets the x, y, width and height of this ellipse.

      Parameters

      • x: number

        The x position of the center of the ellipse.

      • y: number

        The y position of the center of the ellipse.

      • width: number

        The width of the ellipse.

      • height: number

        The height of the ellipse.

      Returns this

    • Returns a Vector2 containing the coordinates of a point on the circumference of the Ellipse based on the given angle.

      Type Parameters

      Parameters

      • ellipse: Geom.Ellipse

        The Ellipse to get the circumference point on.

      • angle: number

        The angle from the center of the Ellipse to the circumference to return the point from. Given in radians.

      • Optionalout: O

        A Vector2 to store the results in. If not given a Point will be created.

      Returns O

    • Check to see if the Ellipse contains the given x / y coordinates.

      Parameters

      • ellipse: Geom.Ellipse

        The Ellipse to check.

      • x: number

        The x coordinate to check within the ellipse.

      • y: number

        The y coordinate to check within the ellipse.

      Returns boolean

    • Check to see if the Ellipse contains the given x and y coordinates as stored in the Vector2.

      Parameters

      • ellipse: Geom.Ellipse

        The Ellipse to check.

      • vec: Math.Vector2

        The Vector2 object to check if its coordinates are within the Ellipse or not.

      Returns boolean

    • Check to see if the Ellipse contains all four points of the given Rectangle object.

      Parameters

      • ellipse: Geom.Ellipse

        The Ellipse to check.

      • rect: object | Geom.Rectangle

        The Rectangle object to check if it's within the Ellipse or not.

      Returns boolean

    • Copies the x, y, width and height properties from the source Ellipse into the given dest Ellipse, then returns the dest Ellipse.

      Type Parameters

      Parameters

      • source: Geom.Ellipse

        The source Ellipse to copy the values from.

      • dest: O

        The destination Ellipse to copy the values to.

      Returns O

    • Compares the x, y, width and height properties of the two given Ellipses. Returns true if they all match, otherwise returns false.

      Parameters

      Returns boolean

    • Returns the bounds of the Ellipse object.

      Type Parameters

      Parameters

      • ellipse: Geom.Ellipse

        The Ellipse to get the bounds from.

      • Optionalout: O

        A Rectangle, or rectangle-like object, to store the ellipse bounds in. If not given a new Rectangle will be created.

      Returns O

    • Returns a Vector2 object containing the coordinates of a point on the circumference of the Ellipse based on the given angle normalized to the range 0 to 1. I.e. a value of 0.5 will give the point at 180 degrees around the circle.

      Type Parameters

      Parameters

      • ellipse: Geom.Ellipse

        The Ellipse to get the circumference point on.

      • position: number

        A value between 0 and 1, where 0 equals 0 degrees, 0.5 equals 180 degrees and 1 equals 360 around the ellipse.

      • Optionalout: O

        A Vector2 object to store the return values in. If not given a new Vector2 object will be created.

      Returns O

    • Returns an array of Vector2 objects containing the coordinates of the points around the circumference of the Ellipse, based on the given quantity or stepRate values.

      Type Parameters

      Parameters

      • ellipse: Geom.Ellipse

        The Ellipse to get the points from.

      • quantity: number

        The amount of points to return. If a falsey value the quantity will be derived from the stepRate instead.

      • OptionalstepRate: number

        Sets the quantity by getting the circumference of the ellipse and dividing it by the stepRate.

      • Optionalout: O

        An array to insert the Vector2 objects in to. If not provided a new array will be created.

      Returns O

    • Offsets the Ellipse by the values given.

      Type Parameters

      Parameters

      • ellipse: O

        The Ellipse to be offset (translated.)

      • x: number

        The amount to horizontally offset the Ellipse by.

      • y: number

        The amount to vertically offset the Ellipse by.

      Returns O

    • Offsets the Ellipse by the values given in the x and y properties of the Vector2 object.

      Type Parameters

      Parameters

      • ellipse: O

        The Ellipse to be offset (translated.)

      • vec: Math.Vector2

        The Vector2 object containing the values to offset the Ellipse by.

      Returns O

    • Returns a uniformly distributed random point from anywhere within the given Ellipse.

      Type Parameters

      Parameters

      • ellipse: Geom.Ellipse

        The Ellipse to get a random point from.

      • Optionalout: O

        A Vector2 object to set the random x and y values in.

      Returns O