-
staticdrw.calculateArc(x, y, rx, ry, start, length, fromCenter, largeArcSweepFlag, sweepFlag){Array}
-
Calculate an arc given its center
Name |
Type |
Default |
Description |
x |
Number
|
|
Origin of the arc along the x-axis |
y |
Number
|
|
Origin of the arc along the y-axis |
rx |
Number
|
|
Radius of the arc along the x-axis |
ry |
Number
|
|
Radius of the arc along the y-axis |
start |
Number
|
|
Starting point of the arc along the circle in degrees |
length |
Number
|
|
Length of the arc in degrees from 0-359 |
fromCenter |
Boolean
|
true
|
optional
Whether the origin is the center of arc or a point along its edge |
largeArcSweepFlag |
*
|
'auto'
|
optional
Large arc sweep flag used in the arc. See Arcs on the MDN for more info. |
sweepFlag |
int
|
0
|
optional
Sweep flag of the arc along the y-axis. See Arcs on the MDN for more info. |
Returns:
Type |
Description |
Array
|
Array of characters representing an arc command |
-
staticdrw.find(path, pattern){Array}
-
Searches the given path for each occurrence of the provided command pattern
Name |
Type |
Default |
Description |
path |
String
|
|
The path to search |
pattern |
String
|
'[A-Za-z]'
|
optional
The search pattern. |
Returns:
Type |
Description |
Array
|
Array of result objects where each entry contains fields the matched substring(match) and the index of the match within the path(index) |
-
staticdrw.getElInstance(el){drw}
-
returns the drw instance associated with the provided element's id attribute
Name |
Type |
Description |
el |
Element
|
The element with the lookup id |
Returns:
Type |
Description |
drw
|
The associate drw, if it exists |
-
staticdrw.getInstance(id){drw}
-
returns the drw instance associated with the id
Name |
Type |
Description |
id |
String
|
The lookup id |
Returns:
Type |
Description |
drw
|
The associate drw, if it exists |
-
staticdrw.split(path){Array}
-
Splits the given path into an array of drawing commands
Name |
Type |
Description |
path |
String
|
The path to search |
Returns:
Type |
Description |
Array
|
An array of drawing commands. |
-
-
add a new drawing command to the path element
Name |
Type |
Description |
cmd |
String
|
The command |
params |
*
|
repeatable
Parameters for the supplied command |
Returns:
Type |
Description |
drw
|
self |
-
-
Adds a new drawing command to the path element without enforcing the drawing mode
Name |
Type |
Description |
cmd |
String
|
The command |
params |
*
|
repeatable
Parameters for the supplied command |
Returns:
Type |
Description |
drw
|
self |
-
arc(x, y, r, start, length, fromCenter, largeArcSweepFlag, sweepFlag){drw}
-
Draw a circular arc
Name |
Type |
Default |
Description |
x |
Number
|
|
Origin of the arc along the x-axis |
y |
Number
|
|
Origin of the arc along the y-axis |
r |
Number
|
|
Radius of the arc |
start |
Number
|
|
Starting point of the arc along the circle in degrees |
length |
Number
|
|
Length of the arc in degrees from 0-359 |
fromCenter |
Boolean
|
true
|
optional
Whether the origin is the center of arc or a point along its edge |
largeArcSweepFlag |
*
|
'auto'
|
optional
Large arc sweep flag used in the arc. See Arcs on the MDN for more info. |
sweepFlag |
int
|
0
|
optional
Sweep flag of the arc along the y-axis. See Arcs on the MDN for more info. |
Returns:
Type |
Description |
drw
|
self |
-
arc2(x, y, rx, rx, start, length, fromCenter, largeArcSweepFlag, sweepFlag){drw}
-
Draw an elliptical arc
Name |
Type |
Default |
Description |
x |
Number
|
|
Origin of the arc along the x-axis |
y |
Number
|
|
Origin of the arc along the y-axis |
rx |
Number
|
|
Radius of the arc along the x-axis |
rx |
Number
|
|
Radius of the arc along the y-axis |
start |
Number
|
|
Starting point of the arc along the circle in degrees |
length |
Number
|
|
Length of the arc in degrees from 0-359 |
fromCenter |
Boolean
|
true
|
optional
Whether the origin is the center of arc or a point along its edge |
largeArcSweepFlag |
*
|
'auto'
|
optional
Large arc sweep flag used in the arc. See Arcs on the MDN for more info. |
sweepFlag |
int
|
0
|
optional
Sweep flag of the arc along the y-axis. See Arcs on the MDN for more info. |
Returns:
Type |
Description |
drw
|
self |
-
circle(x, y, r, fromCenter){drw}
-
draw a circle
Name |
Type |
Default |
Description |
x |
Number
|
|
Origin of the circle along the x-axis |
y |
Number
|
|
Origin of the circle along the y-axis |
r |
Number
|
|
Radius of the circle |
fromCenter |
Boolean
|
true
|
optional
Whether the origin is the center of arc or a point along its edge |
Returns:
Type |
Description |
drw
|
self |
-
-
Clears the drawing command except for the origin
Returns:
Type |
Description |
drw
|
self |
-
-
Close the path with a 'Z' command
Returns:
Type |
Description |
drw
|
self |
-
curve(cx1, cy1, cx2, cy2, x, y){drw}
-
Draw a cubic bezier curve
Name |
Type |
Description |
cx1 |
Number
|
Control point1 along the x-axis |
cy1 |
Number
|
Control point1 along the y-axis |
cx2 |
Number
|
Control point2 along the x-axis |
cy2 |
Number
|
Control point2 along the y-axis |
x |
Number
|
End point along the x-axis |
y |
Number
|
End point along the y-axis |
Returns:
Type |
Description |
drw
|
self |
-
curve2(cx, cy, x, y){drw}
-
Draw a cubic bezier curve. Invokes the 'S' command to chain cubic bezier curves together
Name |
Type |
Description |
cx |
Number
|
Control point along the x-axis |
cy |
Number
|
Control point along the y-axis |
x |
Number
|
End point along the x-axis |
y |
Number
|
End point along the y-axis |
Returns:
Type |
Description |
drw
|
self |
-
ellipse(x, y, rx, ry, fromCenter){drw}
-
draw a ellipse
Name |
Type |
Default |
Description |
x |
Number
|
|
Origin of the ellipse along the x-axis |
y |
Number
|
|
Origin of the ellipse along the y-axis |
rx |
Number
|
|
Radius of the ellipse along the x-axis |
ry |
Number
|
|
Radius of the ellipse along the y-axis |
fromCenter |
Boolean
|
true
|
optional
Whether the origin is the center of arc or a point along its edge |
Returns:
Type |
Description |
drw
|
self |
-
-
Searches the path for the first instance of the specified pattern and returns the results in an array
Name |
Type |
Default |
Description |
pattern |
String
|
'A-Z'
|
optional
The search pattern. |
Returns:
Type |
Description |
Array
|
Array of containing the index of the path command, the command header, the full command, and the remaining path in that order. |
-
insert(index, cmd, params){drw}
-
Inserts a new drawing command into the path element
Name |
Type |
Description |
index |
String
|
Insertion index |
cmd |
String
|
The command |
params |
*
|
repeatable
Parameters for the supplied command |
Returns:
Type |
Description |
drw
|
self |
-
insertRaw(index, cmd, params){drw}
-
Inserts a new drawing command into the path element without enforcing the drawing mode
Name |
Type |
Description |
index |
String
|
Insertion index |
cmd |
String
|
The command |
params |
*
|
repeatable
Parameters for the supplied command |
Returns:
Type |
Description |
drw
|
self |
-
-
Draw a line
Name |
Type |
Description |
x |
Number
|
End point of the line along the x-axis |
y |
Number
|
End point of the line along the y-axis |
Returns:
Type |
Description |
drw
|
self |
-
-
Draw a horizontal line
Name |
Type |
Description |
x |
Number
|
End point of the line along the x-axis |
Returns:
Type |
Description |
drw
|
self |
-
-
Draw a vertical line
Name |
Type |
Description |
y |
Number
|
End point of the line along the y-axis |
Returns:
Type |
Description |
drw
|
self |
-
-
Move the drawing cursor to specific coordinates
Name |
Type |
Description |
x |
Number
|
Cursor position along the x-axis |
y |
Number
|
Cursor position along the y-axis |
Returns:
Type |
Description |
drw
|
self |
-
polygon(x, y, r, sides, rotation){drw}
-
draw a regular polygon
Name |
Type |
Default |
Description |
x |
Number
|
|
Origin of the polygon along the x-axis |
y |
Number
|
|
Origin of the polygon along the y-axis |
r |
Number
|
|
The radius of the polygon |
sides |
int
|
5
|
optional
The number of sides on the polygon |
rotation |
int
|
0
|
optional
The rotation of the polygon in degrees |
Returns:
Type |
Description |
drw
|
self |
-
-
Draw a quadratic bezier curve
Name |
Type |
Description |
cx |
Number
|
Control point along the x-axis |
cy |
Number
|
Control point along the y-axis |
x |
Number
|
End point along the x-axis |
y |
Number
|
End point along the y-axis |
Returns:
Type |
Description |
drw
|
self |
-
-
Draw a quadratic bezier curve. Invokes the 'T' command to chain quadratic bezier curves together
Name |
Type |
Description |
x |
Number
|
End point along the x-axis |
y |
Number
|
End point along the y-axis |
Returns:
Type |
Description |
drw
|
self |
-
-
draw a rectangle
Name |
Type |
Description |
x |
Number
|
Position of the rectangle along the x-axis |
y |
Number
|
Position of the rectangle along the y-axis |
w |
Number
|
Width of the rectangle |
h |
Number
|
Height of the rectangle |
Returns:
Type |
Description |
drw
|
self |
-
-
Set the origin of the path
Name |
Type |
Description |
x |
Number
|
The origin along the x-axis |
y |
Number
|
The origin along the y-axis |
Returns:
Type |
Description |
drw
|
self |
-
-
Set value of the relative property. @see relative
Name |
Type |
Description |
value |
Boolean
|
The value to set |
Returns:
Type |
Description |
drw
|
self |
-
-
Chainable method for setting the slice. @see slice
Name |
Type |
Description |
value |
String
|
The slice value |
Returns:
Type |
Description |
drw
|
self |
-
-
Splits the path into an array of drawing commands
Returns:
Type |
Description |
Array
|
An array of drawing commands. |
-
square(x, y, r, rotation){drw}
-
draw a regular square
Name |
Type |
Default |
Description |
x |
Number
|
|
Origin of the square along the x-axis |
y |
Number
|
|
Origin of the square along the y-axis |
r |
Number
|
|
The radius of the square |
rotation |
int
|
0
|
optional
The rotation of the square in degrees |
Returns:
Type |
Description |
drw
|
self |
-
star(x, y, r1, r2, points, rotation){drw}
-
draw a regular star
Name |
Type |
Default |
Description |
x |
Number
|
|
Origin of the star along the x-axis |
y |
Number
|
|
Origin of the star along the y-axis |
r1 |
Number
|
|
The inner radius of the star |
r2 |
Number
|
|
The outer radius of the star |
points |
int
|
5
|
optional
The number of points on the star |
rotation |
int
|
0
|
optional
The rotation of the star in degrees |
Returns:
Type |
Description |
drw
|
self |
-
triangle(x, y, r, rotation){drw}
-
draw a regular triangle
Name |
Type |
Default |
Description |
x |
Number
|
|
Origin of the triangle along the x-axis |
y |
Number
|
|
Origin of the triangle along the y-axis |
r |
Number
|
|
The radius of the triangle |
rotation |
int
|
0
|
optional
The rotation of the triangle in degrees |
Returns:
Type |
Description |
drw
|
self |