Class: GraphicsFormat

PIXI. GraphicsFormat

new PIXI.GraphicsFormat()

GraphicsFormat.js, line 1

Parse or serialize PIXI.Graphics objects with *.pgf files.

Example
const app = new PIXI.Application();
const graphics = PIXI.GraphicsFormat.parse("f #f00 dr 30 10 100 150 c");
app.stage.addChild(graphics);

Members

static,readonlyPIXI.GraphicsFormat.COMMANDSObject

The aliases for draw commands

Properties:
Name Type Description
c string

Alias for method closePath

h string

Alias for method addHole

m string

Alias for method moveTo

l string

Alias for method lineTo

q string

Alias for method quadraticCurveTo

b string

Alias for method bezierCurveTo

f string

Alias for method beginFill

s string

Alias for method lineStyle

dr string

Alias for method drawRect

rr string

Alias for method drawRoundedRect

rc string

Alias for method drawRoundedRect

dc string

Alias for method drawCircle

ar string

Alias for method arc

at string

Alias for method arcTo

de string

Alias for method drawEllipse

Methods

staticPIXI.GraphicsFormat.parse(contents, graphics){PIXI.Graphics}

GraphicsFormat.js, line 59

Parse a string as a Graphics Object

Name Type Description
contents string

Commands to draw

graphics PIXI.Graphics optional

Graphics object to use, if none is supplied will create new object.

Throws:

Throws error if contents is not well formatted

Type
SyntaxError
Returns:
Type Description
PIXI.Graphics New graphics object created

staticPIXI.GraphicsFormat.stringify(graphics){string}

GraphicsFormat.js, line 69

Convert the graphic to a string

Name Type Description
graphics PIXI.Graphics

Object to convert to string

Returns:
Type Description
string Graphic serialized as string