Global

Methods

bezierCurveTo(x1, y1, cp1x, cp1y, cp2x, cp2y, x2, y2, pointsInArcopt) → {array}

Calculate points for a bezier curve with a starting point and two control points from https://stackoverflow.com/a/15399173/1955997

Parameters:
Name Type Attributes Default Description
x1 number

starting point (usually a moveTo)

y1 number

starting point

cp1x number

first control point

cp1y number

first control point

cp2x number

second control point

cp2y number

second control point

x2 number

ending point

y2 number

ending point

pointsInArc number <optional>
5
Source:
Returns:

[x1, y1, x2, y2, ... xn, yn]

Type
array

circle(x, y, radius, pointsInArcopt) → {array}

calculate points for a circle (calculates using pointsInArc * 4)

Parameters:
Name Type Attributes Default Description
x number
y number
radius number
pointsInArc number <optional>
5
Source:
Returns:

[x1, y1, x2, y2, ... xn, yn]

Type
array

ellipse(x, y, rx, ry, pointsInArcopt) → {array}

calculate points for a ellipse (calculates using pointsInArc * 4)

Parameters:
Name Type Attributes Default Description
x number
y number
rx number
ry number
pointsInArc number <optional>
5
Source:
Returns:

[x1, y1, x2, y2, ... xn, yn]

Type
array

line(x1, y1, x2, y2, thicknessopt) → {array}

calculate points for a line with a certain thickness (either one thickness or a starting and ending thickness)

Parameters:
Name Type Attributes Description
x1 number
y1 number
x2 number
y2 number
thickness number | object <optional>
Properties
Name Type Description
start number
end number
Source:
Returns:

[x1, y1, x2, y2, ... xn, yn]

Type
array

quadraticCurveTo(x1, y1, cp1x, cp1y, x2, y2) → {array}

calculate points in a quadratic curve

Parameters:
Name Type Description
x1 number

starting point

y1 number
cp1x number

control point

cp1y number
x2 number

ending point

y2 number
Source:
Returns:

[x1, y1, x2, y2, ... xn, yn]

Type
array

rect(x, y, width, height) → {array}

calculate points for rectangle

Parameters:
Name Type Description
x number

(center)

y number
width number
height number
Source:
Returns:

[x1, y1, x2, y2, ... xn, yn]

Type
array