PIXI.Polygon

class Polygon

A class to define a shape via user defined coordinates.

Constructor


new PIXI.Polygon(points: Array<PIXI.IPointData> | Array<number>) → {}
Parameters:
Name Type Description
points Array<PIXI.IPointData> | Array<number>

This can be an array of Points that form the polygon, a flat array of numbers that will be interpreted as [x,y, x,y, ...], or the arguments passed can be all the points of the polygon e.g. new PIXI.Polygon(new PIXI.Point(), new PIXI.Point(), ...), or the arguments passed can be flat x,y values e.g. new Polygon(x,y, x,y, x,y, ...) where x and y are Numbers.

Summary


Properties from Polygon

boolean
closeStroke

false after moveTo, true after closePath. In all other cases it is true.

number[]
points

An array of the points of this polygon.

SHAPES.POLY
type = PIXI.SHAPES.POLY

Methods from Polygon

Public Properties


closeStroke Polygon.ts:13
closeStroke: boolean

false after moveTo, true after closePath. In all other cases it is true.

points Polygon.ts:10
points: number[]

An array of the points of this polygon.

type Polygon.ts:16
type: SHAPES.POLY = PIXI.SHAPES.POLY

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

See: PIXI.SHAPES

Public Methods


clone Polygon.ts:55
clone() → {PIXI.Polygon}

Creates a clone of this polygon.

Returns:
Type Description
PIXI.Polygon
  • A copy of the polygon.
contains Polygon.ts:69
contains(x: number, y: number) → {boolean}

Checks whether the x and y coordinates passed to this function are contained within this polygon.

Parameters:
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 polygon.

Powered by webdoc!