Blockly.utils. svgPaths
Methods
arc
arc(command, flags, radius, point) returns string
Draw an elliptical arc curve. These coordinates are unitless and hence in the user coordinate system. See developer.mozilla.org/en-US/docs/Web/SVG/Attribute/d#Elliptical_Arc_Curve
Parameter |
|
---|---|
command |
string The command string. Either 'a' or 'A'. |
flags |
string The flag string. See the MDN documentation for a description and examples. |
radius |
number The radius of the arc to draw. |
point |
string The point to move the cursor to after drawing the arc, specified either in absolute or relative coordinates depending on the command. |
- Returns
-
string
A string of the format 'command radius radius flags point'
curve
curve(command, points) returns string
Draw a cubic or quadratic curve. See developer.mozilla.org/en-US/docs/Web/SVG/Attribute/d#Cubic_B%C3%A9zier_Curve These coordinates are unitless and hence in the user coordinate system.
Parameter |
|
---|---|
command |
string The command to use. Should be one of: c, C, s, S, q, Q. |
points |
Array of string An array containing all of the points to pass to the curve command, in order. The points are represented as strings of the format ' x, y '. Value must not be null. |
- Returns
-
string
A string defining one or more Bezier curves. See the MDN documentation for exact format.
line
line(points) returns string
Draw multiple lines connecting all of the given points in order. This is equivalent to a series of 'l' commands. These coordinates are unitless and hence in the user coordinate system. See developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths#Line_commands
Parameter |
|
---|---|
points |
Array of string An array containing all of the points to draw lines to, in order. The points are represented as strings of the format ' dx,dy '. Value must not be null. |
- Returns
-
string
A string of the format ' l (dx,dy)+ '
lineOnAxis
lineOnAxis(command, val) returns string
Draw a horizontal or vertical line. The first argument specifies the direction and whether the given position is relative or absolute. These coordinates are unitless and hence in the user coordinate system. See developer.mozilla.org/en-US/docs/Web/SVG/Attribute/d#LineTo_path_commands
Parameter |
|
---|---|
command |
string The command to prepend to the coordinate. This should be one of: V, v, H, h. |
val |
number The coordinate to pass to the command. It may be absolute or relative. |
- Returns
-
string
A string of the format ' command val '
lineTo
lineTo(dx, dy) returns string
Draw a line from the current point to the end point, which is the current point shifted by dx along the x-axis and dy along the y-axis. These coordinates are unitless and hence in the user coordinate system. See developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths#Line_commands
Parameter |
|
---|---|
dx |
number The relative x coordinate. |
dy |
number The relative y coordinate. |
- Returns
-
string
A string of the format ' l dx,dy '
moveBy
moveBy(dx, dy) returns string
Move the cursor to the given position without drawing a line. Coordinates are relative. These coordinates are unitless and hence in the user coordinate system. See developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths#Line_commands
Parameter |
|
---|---|
dx |
number The relative x coordinate. |
dy |
number The relative y coordinate. |
- Returns
-
string
A string of the format ' m dx,dy '
moveTo
moveTo(x, y) returns string
Move the cursor to the given position without drawing a line. The coordinates are absolute. These coordinates are unitless and hence in the user coordinate system. See developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths#Line_commands
Parameter |
|
---|---|
x |
number The absolute x coordinate. |
y |
number The absolute y coordinate. |
- Returns
-
string
A string of the format ' M x,y '
point
point(x, y) returns string
Create a string representing the given x, y pair. It does not matter whether the coordinate is relative or absolute. The result has leading and trailing spaces, and separates the x and y coordinates with a comma but no space.
Parameter |
|
---|---|
x |
number The x coordinate. |
y |
number The y coordinate. |
- Returns
-
string
A string of the format ' x,y '