Options
All
  • Public
  • Public/Protected
  • All
Menu

Creates a closed polygon drawing given a list of Vectors.

warning

Use sparingly as Polygons are performance intensive

Hierarchy

  • Polygon

Implements

Index

Constructors

constructor

Properties

anchor

anchor: Vector = Vector.Zero

drawHeight

drawHeight: number

drawWidth

drawWidth: number

fillColor

fillColor: Color

The color to use for the interior of the polygon

filled

filled: boolean = false

Indicates whether the polygon is filled or not.

flipHorizontal

flipHorizontal: boolean

flipVertical

flipVertical: boolean

height

height: number

lineColor

lineColor: Color

The color to use for the lines of the polygon

lineWidth

lineWidth: number = 5

The width of the lines of the polygon

offset

offset: Vector = Vector.Zero

opacity

opacity: number = 1

rotation

rotation: number = 0

scale

scale: Vector = Vector.One

width

width: number

Methods

addEffect

  • addEffect(): void

clearEffects

  • clearEffects(): void

draw

  • draw(ctx: CanvasRenderingContext2D, x: number, y: number): void
  • draw(options: DrawOptions): void
  • Draws the sprite appropriately to the 2D rendering context, at an x and y coordinate.

    Parameters

    • ctx: CanvasRenderingContext2D

      The 2D rendering context

    • x: number

      The x coordinate of where to draw

    • y: number

      The y coordinate of where to draw

    Returns void

  • Draws the sprite with custom options to override internals without mutating them.

    Parameters

    Returns void

removeEffect

  • removeEffect(index: number): void
  • removeEffect(effect: SpriteEffect): void

reset

  • reset(): void