Skip to main content

Path

A raw path defined with a list of drawing commands

If you just want to draw a freeform shape see the simpler Curve item

Extends Item

TYPE
object

Properties

NAMETYPEDESCRIPTION
type"PATH"The type of item
commandsPathCommand[]The list of drawing commands
stylePathStyleThe style of the path
fillRulestringEither "nonzero" or "evenodd"

Type Definitions​

PathStyle​

TYPE
object

Properties

NAMETYPEDESCRIPTION
fillColorstringThe fill color of the shape
fillOpacitynumberThe fill opacity of the shape between 0 and 1
strokeColorstringThe stroke color of the shape
strokeOpacitynumberThe stroke opacity of the shape between 0 and 1
strokeWidthnumberThe stroke width of the shape in pixels
strokeDashnumber[]The pattern of the stroke dash

PathCommand​

TYPE
MoveCommand | LineCommand | QuadCommand | ConicCommand | CubicCommand | CloseCommand

Command​

TYPEvalues
EnumMOVE, LINE, QUAD, CONIC, CUBIC, CLOSE

Commands​

MoveCommand​

Begins a new sub-path at the given (x, y).

Reference.

TYPEvalues
number[][Command.Move, x, y]

LineCommand​

Draw a line from the last point to the given (x, y).

Reference.

TYPEvalues
number[][Command.Line, x, y]

QuadCommand​

Draw a quadratic curve from the last point to (x2, y2) with the control point (x1, y1).

Reference.

TYPEvalues
number[][Command.Quad, x1, y1, x2, y2]

ConicCommand​

Draw a conic from the last point to (x2, y2) with the control point (x1, y1) and the weight w.

Reference.

TYPEvalues
number[][Command.Conic, x1, y1, x2, y2, w]

CubicCommand​

Draw a cubic from the last point to (x3, y3) with the control points (x1, y1) and (x2, y2).

Reference.

TYPEvalues
number[][Command.Cubic, x1, y1, x2, y2, x3, y3]

CloseCommand​

Close the current sub-path.

Reference.

TYPEvalues
number[][Command.Close]