inherited PIXI.Graphics

Hierarchy

  • Graphics
    • PixiGraphics

Constructors

Properties

Accessors

Methods

Constructors

Properties

_accessibleActive: boolean

Member

Memberof

PIXI.DisplayObject#

Todo

Needs docs.

_accessibleDiv: boolean

Member

Memberof

PIXI.DisplayObject#

Todo

Needs docs.

_bounds: Bounds

The bounds object, this is used to calculate and store the bounds of the displayObject.

Member

PIXI.DisplayObject#_bounds

_boundsID: number

Flags the cached bounds as dirty.

Member

PIXI.DisplayObject#_boundsID

_boundsRect: Bounds

Cache of this display-object's bounds-rectangle.

Member

PIXI.DisplayObject#_boundsRect

_createjs: CreatejsGraphics
_destroyed: boolean

If the object has been destroyed via destroy(). If true, it should not be used.

Member

PIXI.DisplayObject#_destroyed

_enabledFilters: Filter[]

Currently enabled filters

Member

PIXI.DisplayObject#_enabledFilters

_fillStyle: FillStyle

Current fill style

Member

PIXI.Graphics#_fillStyle

_holeMode: boolean

Current hole mode is enabled.

Member

PIXI.Graphics#_holeMode

Default

false
@protected
_lastSortedIndex: number

Which index in the children array the display component was before the previous zIndex sort. Used by containers to help sort objects with the same zIndex, by using previous array index as the decider.

Member

PIXI.DisplayObject#_lastSortedIndex

_lineStyle: LineStyle

Current line style

Member

PIXI.Graphics#_lineStyle

_localBounds: Bounds

Local bounds object, swapped with _bounds when using getLocalBounds().

Member

PIXI.DisplayObject#_localBounds

_localBoundsRect: Bounds

Cache of this display-object's local-bounds rectangle.

Member

PIXI.DisplayObject#_localBoundsRect

_mask: null | Container | MaskData

The original, cached mask of the object.

Member

PIXI.DisplayObject#_mask

_matrix: Matrix

Current shape transform matrix.

Member

PIXI.Graphics#_matrix

_tempDisplayObjectParent: Container

Member

_zIndex: number

The zIndex of the displayObject. A higher value will mean it will be rendered on top of other displayObjects within the same container.

Member

PIXI.DisplayObject#_zIndex

accessible: boolean

Flag for if the object is accessible. If true AccessibilityManager will overlay a shadow div with attributes set

Member

Memberof

PIXI.DisplayObject#

accessibleChildren: boolean

Setting to false will prevent any children inside this container to be accessible. Defaults to true.

Member

Memberof

PIXI.DisplayObject#

Default

true
accessibleHint: string

Sets the aria-label attribute of the shadow div

Member

Memberof

PIXI.DisplayObject#

accessiblePointerEvents: string

Specify the pointer-events the accessible div will use Defaults to auto.

Member

Memberof

PIXI.DisplayObject#

Default

'auto'
accessibleTitle: string

Sets the title attribute of the shadow div If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]'

Member

Memberof

PIXI.DisplayObject#

accessibleType: string

Specify the type of div the accessible layer is. Screen readers treat the element differently depending on this type. Defaults to button.

Member

Memberof

PIXI.DisplayObject#

Default

'button'
alpha: number

The opacity of the object.

Member

PIXI.DisplayObject#alpha

angle: number

The angle of the object in degrees. 'rotation' and 'angle' have the same effect on a display object; rotation is in radians, angle is in degrees.

Member

batchDirty: number

Update dirty for limiting calculating batches.

Member

PIXI.Graphics#batchDirty

Default

-1
batchTint: number

Update dirty for limiting calculating tints for batches.

Member

PIXI.Graphics#batchTint

Default

-1
batches: any[]

A collections of batches! These can be drawn by the renderer batch system.

Member

PIXI.Graphics#batches

blendMode: number

The blend mode to be applied to the graphic shape. Apply a value of PIXI.BLEND_MODES.NORMAL to reset the blend mode.

Member

Default

PIXI.BLEND_MODES.NORMAL;

See

PIXI.BLEND_MODES

buttonMode: boolean

If enabled, the mouse cursor use the pointer behavior when hovered over the displayObject if it is interactive Setting this changes the 'cursor' property to 'pointer'.

Example

const sprite = new PIXI.Sprite(texture);
sprite.interactive = true;
sprite.buttonMode = true;

Member

Memberof

PIXI.DisplayObject#

cacheAsBitmap: boolean

When cacheAsBitmap is set to true the graphics object will be rendered as if it was a sprite. This is useful if your graphics element does not change often, as it will speed up the rendering of the object in exchange for taking up texture memory. It is also useful if you need the graphics object to be anti-aliased, because it will be rendered using canvas. This is not recommended if you are constantly redrawing the graphics element.

Name

cacheAsBitmap

Member

Memberof

PIXI.Graphics#

Default

false
children: DisplayObject[]

The array of children of this container.

Member

PIXI.Container#children

currentPath: Polygon

Current path

Member

PIXI.Graphics#currentPath

cursor: string

This defines what cursor mode is used when the mouse cursor is hovered over the displayObject.

Example

const sprite = new PIXI.Sprite(texture);
sprite.interactive = true;
sprite.cursor = 'wait';

See

https://developer.mozilla.org/en/docs/Web/CSS/cursor

Member

Memberof

PIXI.DisplayObject#

fill: FillStyle

The current fill style.

Member

filterArea: Rectangle

The area the filter is applied to. This is used as more of an optimization rather than figuring out the dimensions of the displayObject each frame you can set this rectangle.

Also works as an interaction mask.

Member

PIXI.DisplayObject#filterArea

filters: Filter[]

Sets the filters for the displayObject.

  • IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer. To remove filters simply set this property to 'null'.

Member

PIXI.DisplayObject#filters

geometry: GraphicsGeometry

Includes vertex positions, face indices, normals, colors, UVs, and custom attributes within buffers, reducing the cost of passing all this data to the GPU. Can be shared between multiple Mesh or Graphics objects.

Member

height: number

The height of the Container, setting this will actually modify the scale to achieve the value set

Member

hitArea: IHitArea

Interaction shape. Children will be hit first, then this shape will be checked. Setting this will cause this shape to be checked in hit tests rather than the displayObject's bounds.

Example

const sprite = new PIXI.Sprite(texture);
sprite.interactive = true;
sprite.hitArea = new PIXI.Rectangle(0, 0, 100, 100);

Member

Memberof

PIXI.DisplayObject#

interactive: boolean

Enable interaction events for the DisplayObject. Touch, pointer and mouse events will not be emitted unless interactive is set to true.

Example

const sprite = new PIXI.Sprite(texture);
sprite.interactive = true;
sprite.on('tap', (event) => {
//handle event
});

Member

Memberof

PIXI.DisplayObject#

interactiveChildren: boolean

Determines if the children to the displayObject can be clicked/touched Setting this to false allows PixiJS to bypass a recursive hitTest function

Member

Memberof

PIXI.Container#

isMask: boolean

Does any other displayObject use this object as a mask?

Member

PIXI.DisplayObject#isMask

isSprite: boolean

used to fast check if a sprite is.. a sprite!

Member

PIXI.DisplayObject#isSprite

line: LineStyle

The current line style.

Member

localTransform: Matrix

Current transform of the object based on local factors: position, scale, other stuff.

Member

mask: null | Container | MaskData

Sets a mask for the displayObject. A mask is an object that limits the visibility of an object to the shape of the mask applied to it. In PixiJS a regular mask must be a PIXI.Graphics or a PIXI.Sprite object. This allows for much faster masking in canvas as it utilities shape clipping. To remove a mask, set this property to null.

For sprite mask both alpha and red channel are used. Black mask is the same as transparent mask.

Example

const graphics = new PIXI.Graphics();
graphics.beginFill(0xFF3300);
graphics.drawRect(50, 250, 100, 100);
graphics.endFill();

const sprite = new PIXI.Sprite(texture);
sprite.mask = graphics;

Todo

At the moment, PIXI.CanvasRenderer doesn't support PIXI.Sprite as mask.

Member

name: string

The instance name of the object.

Memberof

PIXI.DisplayObject#

Member

name

parent: Container

The display object container that contains this display object.

Member

PIXI.DisplayObject#parent

pivot: ObservablePoint

The pivot point of the displayObject that it rotates around. Assignment by value since pixi-v4.

Member

pluginName: string

Renderer plugin for batching

Member

PIXI.Graphics#pluginName

Default

'batch'
position: ObservablePoint

The coordinate of the object relative to the local coordinates of the parent. Assignment by value since pixi-v4.

Member

renderable: boolean

Can this object be rendered, if false the object will not be drawn but the updateTransform methods will still be called.

Only affects recursive calls from parent. You can ask for bounds manually.

Member

PIXI.DisplayObject#renderable

rotation: number

The rotation of the object in radians. 'rotation' and 'angle' have the same effect on a display object; rotation is in radians, angle is in degrees.

Member

scale: ObservablePoint

The scale factor of the object. Assignment by value since pixi-v4.

Member

shader: Shader

Represents the vertex and fragment shaders that processes the geometry and runs on the GPU. Can be shared between multiple Graphics objects.

Member

PIXI.Graphics#shader

skew: ObservablePoint

The skew factor for the object in radians. Assignment by value since pixi-v4.

Member

sortDirty: boolean

Should children be sorted by zIndex at the next updateTransform call. Will get automatically set to true if a new child is added, or if a child's zIndex changes.

Member

PIXI.Container#sortDirty

sortableChildren: boolean

If set to true, the container will sort its children by zIndex value when updateTransform() is called, or manually if sortChildren() is called.

This actually changes the order of elements in the array, so should be treated as a basic solution that is not performant compared to other solutions, such as

Link

https://github.com/pixijs/pixi-display

Also be aware of that this may not work nicely with the addChildAt() function, as the zIndex sorting may cause the child to automatically sorted to another position.

See

PIXI.settings.SORTABLE_CHILDREN

Member

PIXI.Container#sortableChildren

state: State

Represents the WebGL state the Graphics required to render, excludes shader and geometry. E.g., blend mode, culling, depth testing, direction of rendering triangles, backface, etc.

Member

PIXI.Graphics#state

tint: number

The tint applied to the graphic shape. This is a hex value. A value of 0xFFFFFF will remove any tint effect.

Member

Default

0xFFFFFF
transform: Transform

World transform and local transform of this object. This will become read-only later, please do not assign anything there unless you know what are you doing.

Member

PIXI.DisplayObject#transform

vertexData: Float32Array

Copy of the object vertex data.

Member

PIXI.Graphics#vertexData

visible: boolean

The visibility of the object. If false the object will not be drawn, and the updateTransform function will not be called.

Only affects recursive calls from parent. You can ask for bounds or call updateTransform manually.

Member

PIXI.DisplayObject#visible

width: number

The width of the Container, setting this will actually modify the scale to achieve the value set

Member

worldAlpha: number

The multiplied alpha of the displayObject.

Member

PIXI.DisplayObject#worldAlpha

worldTransform: Matrix

Current transform of the object based on world (parent) factors.

Member

worldVisible: boolean

Indicates if the object is globally visible.

Member

x: number

The position of the displayObject on the x axis relative to the local coordinates of the parent. An alias to position.x

Member

y: number

The position of the displayObject on the y axis relative to the local coordinates of the parent. An alias to position.y

Member

zIndex: number

The zIndex of the displayObject. If a container has the sortableChildren property set to true, children will be automatically sorted by zIndex value; a higher value will mean it will be moved towards the end of the array, and thus rendered on top of other displayObjects within the same container.

Member

Accessors

Methods

  • Protected

    Retrieves the bounds of the graphic shape as a rectangle object

    Returns void

  • Protected

    Initialize the curve

    Parameters

    • Optional x: number
    • Optional y: number

    Returns void

  • Protected

    Populating batches for rendering

    Returns void

  • Recursively updates transform of all objects from the root to this one internal function for toLocal()

    Returns void

  • Protected

    Renders the object using the WebGL renderer

    Parameters

    • renderer: Renderer

      The renderer

    Returns void

  • Protected

    Renders the batches using the BathedRenderer plugin

    Parameters

    • renderer: Renderer

      The renderer

    Returns void

  • Protected

    Renders the graphics direct

    Parameters

    • renderer: Renderer

      The renderer

    Returns void

  • Renders specific DrawCall

    Parameters

    • renderer: Renderer
    • drawCall: BatchDrawCall

    Returns void

  • Protected

    Resolves shader for direct rendering

    Parameters

    • renderer: Renderer

      The renderer

    Returns void

  • Adds one or more children to the container.

    Multiple items can be added like so: myContainer.addChild(thingOne, thingTwo, thingThree)

    Type Parameters

    • TChildren extends DisplayObject[]

    Parameters

    • Rest ...children: TChildren

      The DisplayObject(s) to add to the container

    Returns TChildren[0]

    The first child that was added.

  • Adds a child to the container at a specified index. If the index is out of bounds an error will be thrown

    Type Parameters

    • T extends DisplayObject

    Parameters

    • child: T

      The child to add

    • index: number

      The index to place the child in

    Returns T

    The child that was added.

  • Parameters

    • event: InteractionEventTypes
    • fn: ((event) => void)
        • (event): void
        • Parameters

          • event: InteractionEvent

          Returns void

    • Optional context: any

    Returns this

  • Parameters

    • event: string | symbol
    • fn: Function
    • Optional context: any

    Returns this

  • The arc method creates an arc/curve (used to create circles, or parts of circles).

    Parameters

    • cx: number

      The x-coordinate of the center of the circle

    • cy: number

      The y-coordinate of the center of the circle

    • radius: number

      The radius of the circle

    • startAngle: number

      The starting angle, in radians (0 is at the 3 o'clock position of the arc's circle)

    • endAngle: number

      The ending angle, in radians

    • Optional anticlockwise: boolean

      Specifies whether the drawing should be counter-clockwise or clockwise. False is default, and indicates clockwise, while true indicates counter-clockwise.

    Returns Graphics

    This Graphics object. Good for chaining method calls

  • The arcTo() method creates an arc/curve between two tangents on the canvas.

    "borrowed" from https://code.google.com/p/fxcanvas/ - thanks google!

    Parameters

    • x1: number

      The x-coordinate of the first tangent point of the arc

    • y1: number

      The y-coordinate of the first tangent point of the arc

    • x2: number

      The x-coordinate of the end of the arc

    • y2: number

      The y-coordinate of the end of the arc

    • radius: number

      The radius of the arc

    Returns Graphics

    This Graphics object. Good for chaining method calls

  • Specifies a simple one-color fill that subsequent calls to other Graphics methods (such as lineTo() or drawCircle()) use when drawing.

    Parameters

    • Optional color: number

      the color of the fill

    • Optional alpha: number

      the alpha of the fill

    Returns Graphics

    This Graphics object. Good for chaining method calls

  • Begin adding holes to the last draw shape IMPORTANT: holes must be fully inside a shape to work Also weirdness ensues if holes overlap! Ellipses, Circles, Rectangles and Rounded Rectangles cannot be holes or host for holes in CanvasRenderer, please use moveTo lineTo, quadraticCurveTo if you rely on pixi-legacy bundle.

    Returns Graphics

    Returns itself.

  • Begin the texture fill

    Parameters

    • Optional options: {
          alpha?: number;
          color?: number;
          matrix?: Matrix;
          texture?: Texture;
      }

      Object object.

      • Optional alpha?: number

        Alpha of fill

      • Optional color?: number

        Background to fill behind texture

      • Optional matrix?: Matrix

        Transform matrix

      • Optional texture?: Texture

        Texture to fill

    Returns Graphics

    This Graphics object. Good for chaining method calls

  • Calculate the points for a bezier curve and then draws it.

    Parameters

    • cpX: number

      Control point x

    • cpY: number

      Control point y

    • cpX2: number

      Second Control point x

    • cpY2: number

      Second Control point y

    • toX: number

      Destination point x

    • toY: number

      Destination point y

    Returns Graphics

    This Graphics object. Good for chaining method calls

  • Recalculates the bounds of the container.

    Returns void

  • Protected

    Recalcuate the tint by applying tin to batches using Graphics tint.

    Returns void

  • Protected

    If there's a transform update or a change to the shape of the geometry, recaculate the vertices.

    Returns void

  • Clears the graphics that were drawn to this Graphics object, and resets fill and line style settings.

    Returns Graphics

    This Graphics object. Good for chaining method calls

  • Creates a new Graphics object with the same values as this one. Note that only the geometry of the object is cloned, not its transform (position,scale,etc)

    Returns Graphics

    A clone of the graphics object

  • Closes the current path.

    Returns Graphics

    Returns itself.

  • Container default updateTransform, does update children of container. Will crash if there's no parent element.

    Returns void

    Memberof

    PIXI.Container#

    Function

    containerUpdateTransform

  • Tests if a point is inside this graphics object

    Parameters

    • point: IPointData

      the point to test

    Returns boolean

    the result of the test

  • Destroys the Graphics object.

    Parameters

    • Optional options: {
          baseTexture?: boolean;
          children?: boolean;
          texture?: boolean;
      }

      Options parameter. A boolean will act as if all options have been set to that value

      • Optional baseTexture?: boolean

        Only used for child Sprites if options.children is set to true Should it destroy the base texture of the child sprite

      • Optional children?: boolean

        if set to true, all the children will have their destroy method called as well. 'options' will be passed on to those calls.

      • Optional texture?: boolean

        Only used for child Sprites if options.children is set to true Should it destroy the texture of the child sprite

    Returns void

  • Pair method for enableTempParent

    Parameters

    • cacheParent: DisplayObject

      actual parent of element

    Returns void

  • DisplayObject default updateTransform, does not update children of container. Will crash if there's no parent element.

    Returns void

    Memberof

    PIXI.DisplayObject#

    Function

    displayObjectUpdateTransform

  • Draw Rectangle with chamfer corners.

    Note: Only available with @pixi/graphics-extras.

    Parameters

    • x: number

      Upper left corner of rect

    • y: number

      Upper right corner of rect

    • width: number

      Width of rect

    • height: number

      Height of rect

    • chamfer: number

      accept negative or positive values

    Returns Graphics

    Returns self.

    Method

    PIXI.Graphics#drawChamferRect

  • Draws a circle.

    Parameters

    • x: number

      The X coordinate of the center of the circle

    • y: number

      The Y coordinate of the center of the circle

    • radius: number

      The radius of the circle

    Returns Graphics

    This Graphics object. Good for chaining method calls

  • Draws an ellipse.

    Parameters

    • x: number

      The X coordinate of the center of the ellipse

    • y: number

      The Y coordinate of the center of the ellipse

    • width: number

      The half width of the ellipse

    • height: number

      The half height of the ellipse

    Returns Graphics

    This Graphics object. Good for chaining method calls

  • Draw Rectangle with fillet corners.

    Note: Only available with @pixi/graphics-extras.

    Parameters

    • x: number

      Upper left corner of rect

    • y: number

      Upper right corner of rect

    • width: number

      Width of rect

    • height: number

      Height of rect

    • fillet: number

      non-zero real number, size of corner cutout

    Returns Graphics

    Returns self.

    Method

    PIXI.Graphics#drawFilletRect

  • Draws a polygon using the given path.

    Parameters

    • Rest ...path: (number[] | Polygon | Point[])[]

      The path data used to construct the polygon.

    Returns Graphics

    This Graphics object. Good for chaining method calls

  • Draws a rectangle shape.

    Parameters

    • x: number

      The X coord of the top-left of the rectangle

    • y: number

      The Y coord of the top-left of the rectangle

    • width: number

      The width of the rectangle

    • height: number

      The height of the rectangle

    Returns Graphics

    This Graphics object. Good for chaining method calls

  • Draw a regular polygon where all sides are the same length.

    Note: Only available with @pixi/graphics-extras.

    Parameters

    • x: number

      X position

    • y: number

      Y position

    • radius: number

      Polygon radius

    • sides: number

      Minimum value is 3

    • rotation: number

      Starting rotation values in radians..

    Returns Graphics

    Method

    PIXI.Graphics#drawRegularPolygon

  • Draw a rectangle shape with rounded/beveled corners.

    Parameters

    • x: number

      The X coord of the top-left of the rectangle

    • y: number

      The Y coord of the top-left of the rectangle

    • width: number

      The width of the rectangle

    • height: number

      The height of the rectangle

    • radius: number

      Radius of the rectangle corners

    Returns Graphics

    This Graphics object. Good for chaining method calls

  • Draw any shape.

    Parameters

    • shape: Rectangle | Polygon | Circle | Ellipse | RoundedRectangle

      Shape to draw

    Returns Graphics

    This Graphics object. Good for chaining method calls

  • Draw a star shape with an arbitrary number of points.

    Parameters

    • x: number

      Center X position of the star

    • y: number

      Center Y position of the star

    • points: number

      The number of points of the star, must be > 1

    • radius: number

      The outer radius of the star

    • Optional innerRadius: number

      The inner radius between points, default half radius

    • Optional rotation: number

      The rotation of the star in radians, where 0 is vertical

    Returns Graphics

    This Graphics object. Good for chaining method calls

  • Draw a torus shape, like a donut. Can be used for something like a circle loader.

    Note: Only available with @pixi/graphics-extras.

    Parameters

    • x: number

      X position

    • y: number

      Y position

    • innerRadius: number

      Inner circle radius

    • outerRadius: number

      Outer circle radius

    • Optional startArc: number

      Where to begin sweep, in radians, 0.0 = to the right

    • Optional endArc: number

      Where to end sweep, in radians

    Returns Graphics

    Method

    PIXI.Graphics#drawTorus

  • Calls each of the listeners registered for a given event.

    Parameters

    • event: string | symbol

      The event name.

    • Rest ...args: any[]

      Arguments that are passed to registered listeners

    Returns boolean

    true if the event had listeners, else false.

  • Used in Renderer, cacheAsBitmap and other places where you call an updateTransform on root

    const cacheParent = elem.enableTempParent();
    elem.updateTransform();
    elem.disableTempParent(cacheParent);

    Returns DisplayObject

    current parent

  • Applies a fill to the lines and shapes that were added since the last call to the beginFill() method.

    Returns Graphics

    This Graphics object. Good for chaining method calls

  • End adding holes to the last draw shape

    Returns Graphics

    Returns itself.

  • Return an array listing the events for which the emitter has registered listeners.

    Returns (string | symbol)[]

  • Protected

    Finish the polygon object.

    Returns void

  • Retrieves the bounds of the displayObject as a rectangle object.

    Parameters

    • Optional skipUpdate: boolean

      Setting to true will stop the transforms of the scene graph from being updated. This means the calculation returned MAY be out of date BUT will give you a nice performance boost.

    • Optional rect: Rectangle

      Optional rectangle to store the result of the bounds calculation.

    Returns Rectangle

    The rectangular bounding area.

  • Returns the child at the specified index

    Parameters

    • index: number

      The index to get the child at

    Returns DisplayObject

    The child at the given index, if any.

  • Returns the display object in the container.

    Recursive searches are done in a preorder traversal.

    Parameters

    • name: string

      Instance name.

    • Optional deep: boolean

      Whether to search recursively

    Returns DisplayObject

    The child with the specified name.

    Method

    getChildByName

    Memberof

    PIXI.Container#

  • Returns the index position of a child DisplayObject instance

    Parameters

    • child: DisplayObject

      The DisplayObject instance to identify

    Returns number

    The index position of the child display object to identify

  • Returns the global position of the displayObject. Does not depend on object scale, rotation and pivot.

    Parameters

    • Optional point: Point

      The point to write the global value to.

    • Optional skipUpdate: boolean

      Setting to true will stop the transforms of the scene graph from being updated. This means the calculation returned MAY be out of date BUT will give you a nice performance boost.

    Returns Point

    The updated point.

    Method

    getGlobalPosition

    Memberof

    PIXI.DisplayObject#

  • Retrieves the local bounds of the displayObject as a rectangle object.

    Parameters

    • Optional rect: Rectangle

      Optional rectangle to store the result of the bounds calculation.

    • Optional skipChildrenUpdate: boolean

      Setting to true will stop re-calculation of children transforms, it was default behaviour of pixi 4.0-5.2 and caused many problems to users.

    Returns Rectangle

    The rectangular bounding area.

  • True if graphics consists of one rectangle, and thus, can be drawn like a Sprite and masked with gl.scissor.

    Returns boolean

    True if only 1 rect.

  • Specifies the line style used for subsequent calls to Graphics methods such as the lineTo() method or the drawCircle() method.

    Parameters

    • Optional width: number

      width of the line to draw, will update the objects stored style

    • Optional color: number

      color of the line to draw, will update the objects stored style

    • Optional alpha: number

      alpha of the line to draw, will update the objects stored style

    • Optional alignment: number

      alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)

    • Optional native: boolean

      If true the lines will be draw using LINES instead of TRIANGLE_STRIP

    Returns Graphics

    This Graphics object. Good for chaining method calls

    Method

    PIXI.Graphics#lineStyle

  • Specifies the line style used for subsequent calls to Graphics methods such as the lineTo() method or the drawCircle() method.

    Parameters

    • Optional width: number

      width of the line to draw, will update the objects stored style

    • Optional color: number

      color of the line to draw, will update the objects stored style

    • Optional alpha: number

      alpha of the line to draw, will update the objects stored style

    • Optional alignment: number

      alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)

    • Optional native: boolean

      If true the lines will be draw using LINES instead of TRIANGLE_STRIP

    Returns Graphics

    This Graphics object. Good for chaining method calls

    Method

    PIXI.Graphics#lineStyle

  • Like line style but support texture for line fill.

    Parameters

    • Optional options: {
          alignment?: number;
          alpha?: number;
          cap?: LINE_CAP;
          color?: number;
          join?: LINE_JOIN;
          matrix?: Matrix;
          miterLimit?: number;
          native?: boolean;
          texture?: Texture;
          width?: number;
      }

      Collection of options for setting line style.

      • Optional alignment?: number

        alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)

      • Optional alpha?: number

        alpha of the line to draw, will update the objects stored style

      • Optional cap?: LINE_CAP

        line cap style

      • Optional color?: number

        color of the line to draw, will update the objects stored style. Default 0xFFFFFF if texture present.

      • Optional join?: LINE_JOIN

        line join style

      • Optional matrix?: Matrix

        Texture matrix to transform texture

      • Optional miterLimit?: number

        miter limit ratio

      • Optional native?: boolean

        If true the lines will be draw using LINES instead of TRIANGLE_STRIP

      • Optional texture?: Texture

        Texture to use

      • Optional width?: number

        width of the line to draw, will update the objects stored style

    Returns Graphics

    This Graphics object. Good for chaining method calls

  • Draws a line using the current line style from the current drawing position to (x, y); The current drawing position is then set to (x, y).

    Parameters

    • x: number

      the X coordinate to draw to

    • y: number

      the Y coordinate to draw to

    Returns Graphics

    This Graphics object. Good for chaining method calls

  • Return the number of listeners listening to a given event.

    Parameters

    • event: string | symbol

      The event name.

    Returns number

  • Return the listeners registered for a given event.

    Parameters

    • event: string | symbol

      The event name.

    Returns Function[]

  • Moves the current drawing position to x, y.

    Parameters

    • x: number

      the X coordinate to move to

    • y: number

      the Y coordinate to move to

    Returns Graphics

    This Graphics object. Good for chaining method calls

  • Parameters

    • event: string
    • Optional fn: Function
    • Optional context: any

    Returns this

  • Parameters

    • event: "removed" | "added"
    • fn: ((displayObject) => void)
        • (displayObject): void
        • Parameters

          • displayObject: DisplayObject

          Returns void

    • Optional context: any

    Returns this

  • Parameters

    • event: string
    • fn: Function
    • Optional context: any

    Returns this

  • Protected

    Overridable method that can be used by Container subclasses whenever the children array is modified

    Returns void

  • Parameters

    • event: "removed" | "added"
    • fn: ((displayObject) => void)
        • (displayObject): void
        • Parameters

          • displayObject: DisplayObject

          Returns void

    • Optional context: any

    Returns this

  • Parameters

    • event: string
    • fn: Function
    • Optional context: any

    Returns this

  • Calculate the points for a quadratic bezier curve and then draws it. Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c

    Parameters

    • cpX: number

      Control point x

    • cpY: number

      Control point y

    • toX: number

      Destination point x

    • toY: number

      Destination point y

    Returns Graphics

    This Graphics object. Good for chaining method calls

  • Parameters

    • Optional event: InteractionEventTypes

    Returns this

  • Parameters

    • Optional event: string | symbol

    Returns this

  • Removes one or more children from the container.

    Type Parameters

    • TChildren extends DisplayObject[]

    Parameters

    • Rest ...children: TChildren

      The DisplayObject(s) to remove

    Returns TChildren[0]

    The first child that was removed.

  • Removes a child from the specified index position.

    Parameters

    • index: number

      The index to get the child from

    Returns DisplayObject

    The child that was removed.

  • Removes all children from this container that are within the begin and end indexes.

    Parameters

    • Optional beginIndex: number

      The beginning position.

    • Optional endIndex: number

      The ending position. Default value is size of the container.

    Returns DisplayObject[]

    List of removed children

  • Parameters

    • event: InteractionEventTypes
    • Optional fn: ((event) => void)
        • (event): void
        • Parameters

          • event: InteractionEvent

          Returns void

    • Optional context: any

    Returns this

  • Parameters

    • event: string | symbol
    • Optional fn: Function
    • Optional context: any

    Returns this

  • Renders the object using the WebGL renderer

    Parameters

    • renderer: Renderer

      The renderer

    Returns void

  • Protected

    Render the object using the WebGL renderer and advanced features.

    Parameters

    • renderer: Renderer

      The renderer

    Returns void

  • Changes the position of an existing child in the display object container

    Parameters

    • child: DisplayObject

      The child DisplayObject instance for which you want to change the index number

    • index: number

      The resulting index number for the child display object

    Returns void

  • Apply a matrix to the positional data.

    Parameters

    • matrix: Matrix

      Matrix to use for transform current shape.

    Returns Graphics

    Returns itself.

  • Set the parent Container of this DisplayObject.

    Parameters

    • container: Container

      The Container to add this DisplayObject to.

    Returns Container

    The Container that this DisplayObject was added to.

  • Convenience function to set the position, scale, skew and pivot at once.

    Parameters

    • Optional x: number

      The X position

    • Optional y: number

      The Y position

    • Optional scaleX: number

      The X scale value

    • Optional scaleY: number

      The Y scale value

    • Optional rotation: number

      The rotation

    • Optional skewX: number

      The X skew value

    • Optional skewY: number

      The Y skew value

    • Optional pivotX: number

      The X pivot value

    • Optional pivotY: number

      The Y pivot value

    Returns DisplayObject

    The DisplayObject instance

  • Sorts children by zIndex. Previous order is mantained for 2 children with the same zIndex.

    Returns void

  • Protected

    Start a polygon object internally

    Returns void

  • Swaps the position of 2 Display Objects within this container.

    Parameters

    • child: DisplayObject

      First display object to swap

    • child2: DisplayObject

      Second display object to swap

    Returns void

  • Calculates the global position of the display object.

    Parameters

    • position: IPointData

      The world origin to calculate from.

    • Optional point: Point

      A Point object in which to store the value, optional (otherwise will create a new Point).

    • Optional skipUpdate: boolean

      Should we skip the update transform.

    Returns Point

    A point object representing the position of this object.

  • Calculates the local position of the display object relative to another point.

    Parameters

    • position: IPointData

      The world origin to calculate from.

    • Optional from: DisplayObject

      The DisplayObject to calculate the global position from.

    • Optional point: Point

      A Point object in which to store the value, optional (otherwise will create a new Point).

    • Optional skipUpdate: boolean

      Should we skip the update transform

    Returns Point

    A point object representing the position of this object

  • Updates the transform on all children of this container for rendering

    Returns void

  • Mixes all enumerable properties and methods from a source object to DisplayObject.

    Parameters

    • source: any

      The source of properties and methods to mix in.

    Returns void

Generated using TypeDoc