Class: Rectangle

PIXI. Rectangle

new PIXI.Rectangle(x, y, width, height)

the Rectangle object is an area defined by its position, as indicated by its top-left corner point (x, y) and by its width and its height.

Name Type Description
x number

The X coordinate of the upper-left corner of the rectangle

y number

The Y coordinate of the upper-left corner of the rectangle

width number

The overall width of this rectangle

height number

The overall height of this rectangle

Members

static,constantPIXI.Rectangle.EMPTY

A constant empty rectangle.

heightnumber

Default Value:
  • 0

typenumber

The type of the object, mainly used to avoid instanceof checks

widthnumber

Default Value:
  • 0

xnumber

Default Value:
  • 0

ynumber

Default Value:
  • 0

Methods

Creates a clone of this Rectangle

Returns:
Type Description
PIXI.Rectangle a copy of the rectangle

contains(x, y){boolean}

Checks whether the x and y coordinates given are contained within this Rectangle

Name Type Description
x number

The X coordinate of the point to test

y number

The Y coordinate of the point to test

Returns:
Type Description
boolean Whether the x/y coordinates are within this Rectangle