Constructor
new VectorObjectBuilder(vector_object)
Creates a new VectorObjectBuilder from a VectorObject.
Name | Type | Description |
---|---|---|
vector_object | VectorObject | The vector object to start building on. |
- Source
Classes
Methods
actual_path_as_path(untransformopt, recursiveopt) → {VectorObjectBuilder}
Applies the current transformation to the path of the VectorObjectBuilder.
Name | Type | Attributes | Description |
---|---|---|---|
untransform | boolean | | <optional> | Whether to remove transformations after applying the current transformation to the path, default is true. |
recursive | boolean | | <optional> | Whether to apply the actual path as path operation to the children of the vector object, default is true. |
- Source
The vector object being built with the apply transformation operation.
- Type:
- VectorObjectBuilder
add_child(child) → {VectorObjectBuilder}
Adds a child to the VectorObjectBuilder.
Name | Type | Description |
---|---|---|
child | VectorObjectBuilder | The child to add to the vector object. |
- Source
The vector object being built with the add child operation.
- Type:
- VectorObjectBuilder
add_children(children) → {VectorObjectBuilder}
Adds a child to the VectorObjectBuilder.
Name | Type | Description |
---|---|---|
children | Array.<VectorObjectBuilder> | The children to add at the end of the vector object. |
- Source
The vector object being built with the add children operation.
- Type:
- VectorObjectBuilder
apply_transform(matrix, recursiveopt) → {VectorObjectBuilder}
Applies the TransformationMatrix to the VectorObjectBuilder.
Name | Type | Attributes | Description |
---|---|---|---|
matrix | TransformationMatrix | The matrix in CSS format to apply to the vector object. | |
recursive | boolean | | <optional> | Whether to apply the apply transform operation to the children of the vector object, default is true. |
- Source
The vector object being built with the apply transform operation.
- Type:
- VectorObjectBuilder
arrange_children(directionopt, buffopt, aligned_edgeopt, centeropt, recursiveopt) → {VectorObjectBuilder}
Arranges the children of the VectorObjectBuilder in the given direction, with a buff distance between them and aligning at the given edge.
Name | Type | Attributes | Description |
---|---|---|---|
direction | Point2D | | <optional> | The direction to arrange the children. If not given, the children will be arranged horizontally in the positive x direction. |
buff | number | | <optional> | The buffer to leave between the children. If not given, the children will be touching, default is 0. |
aligned_edge | Point2D | | <optional> | The edge of the children to align with the point. If not given, the children will be aligned at the middle. |
center | Point2D | | <optional> | The center of the children. If not given, the children won't be centered at any point. |
recursive | boolean | | <optional> | Whether to apply the arrange subobjects operation to the children of the vector object, default is true. |
- Source
The vector object being built with the arrange subobjects operation.
- Type:
- VectorObjectBuilder
become_partial(start, end, samplesopt, extra_lengthopt, recursiveopt) → {VectorObjectBuilder}
Trims the stroke of the VectorObjectBuilder to the given start and end proportions.
Name | Type | Attributes | Description |
---|---|---|---|
start | number | The proportion of the path to start at. | |
end | number | The proportion of the path to end at. | |
samples | number | | <optional> | Number of samples to compute the length of each cubic bezier curve segment. |
extra_length | number | | <optional> | Extra length to add to each length computation to ensure the path is not too short. |
recursive | boolean | | <optional> | Whether to apply the become partial operation to the children of the vector object, default is true |
- Source
The vector object being built with the become partial operation.
- Type:
- VectorObjectBuilder
bezier_curve_to(p1, p2, p3) → {VectorObjectBuilder}
Draws a cubic bezier curve from the current drawing point with the given control Point2Ds and end Point2D.
Name | Type | Description |
---|---|---|
p1 | Point2D | The first control point of the bezier curve. |
p2 | Point2D | The second control point of the bezier curve. |
p3 | Point2D | The end point of the bezier curve. |
- Source
The vector object being built with the bezier curve to operation.
- Type:
- VectorObjectBuilder
build() → {VectorObject}
Builds the VectorObject by applying sequentially all the operations to the VectorObjectBuilder.
- Source
The vector object built by applying the operations to it.
- Type:
- VectorObject
clone() → {VectorObjectBuilder}
Clones the VectorObjectBuilder.
- Source
A clone of the vector object builder.
- Type:
- VectorObjectBuilder
close() → {VectorObjectBuilder}
Closes the current subpath of the VectorObjectBuilder.
- Source
The vector object being built with the close operation.
- Type:
- VectorObjectBuilder
fade_fill(factor, recursiveopt) → {VectorObjectBuilder}
Fades fill's opacity of the VectorObjectBuilder by the given factor.
Name | Type | Attributes | Description |
---|---|---|---|
factor | number | The factor to fade the fill style by. | |
recursive | boolean | | <optional> | Whether to apply the fade fill operation to the children of the vector object. |
- Source
The vector object being built with the fade fill operation.
- Type:
- VectorObjectBuilder
fade_stroke(factor, recursiveopt) → {VectorObjectBuilder}
Fades stroke's opacity of the VectorObjectBuilder by the given factor.
Name | Type | Attributes | Description |
---|---|---|---|
factor | number | The factor to fade the stroke style by. | |
recursive | boolean | | <optional> | Whether to apply the fade stroke operation to the children of the vector object. |
- Source
The vector object being built with the fade stroke operation.
- Type:
- VectorObjectBuilder
insert_child(index, child) → {VectorObjectBuilder}
Inserts a child into the VectorObjectBuilder at the given index.
Name | Type | Description |
---|---|---|
index | number | The index to insert the child at. |
child | VectorObjectBuilder | The child to insert into the vector object. |
- Source
The vector object being built with the insert child operation.
- Type:
- VectorObjectBuilder
insert_children(index, children) → {VectorObjectBuilder}
Inserts children into the VectorObjectBuilder at the given index.
Name | Type | Description |
---|---|---|
index | number | The index to insert the children at. |
children | Array.<VectorObjectBuilder> | The children to insert into the vector object. |
- Source
The vector object being built with the insert children operation.
- Type:
- VectorObjectBuilder
lerp_fill(fill, t, xopt, yopt, widthopt, heightopt, data_widthopt, data_heightopt, recursiveopt) → {VectorObjectBuilder}
Linearly interpolates the fill Style of the VectorObjectBuilder with another VectorObjectBuilder.
Name | Type | Attributes | Description |
---|---|---|---|
fill | Style | The vector object to interpolate the fill style with. | |
t | number | The factor to interpolate the fill style by. | |
x | number | | <optional> | The image's top left corner x-coordinate. It must be provided if the fill style contains an image or different kinds of gradients. |
y | number | | <optional> | The image's top left corner y-coordinate. It must be provided if the fill style contains an image or different kinds of gradients. |
width | number | | <optional> | The image's rendering width. It must be provided if the fill style contains an image or different kinds of gradients. |
height | number | | <optional> | The image's rendering height. It must be provided if the fill style contains an image or different kinds of gradients. |
data_width | number | | <optional> | The image's number of pixels in a row. It must be provided if the fill style contains an image or different kinds of gradients. |
data_height | number | | <optional> | The image's number of pixels in a column. It must be provided if the fill style contains an image or different kinds of gradients. |
recursive | boolean | | <optional> | Whether to apply the interpolate fill operation to the children of the vector object, default is true. |
- Source
The vector object being built with the interpolate fill operation.
- Type:
- VectorObjectBuilder
lerp_stroke(stroke, t, xopt, yopt, widthopt, heightopt, data_widthopt, data_heightopt, recursiveopt) → {VectorObjectBuilder}
Linearly interpolates the stroke Style of the VectorObjectBuilder with another VectorObjectBuilder.
Name | Type | Attributes | Description |
---|---|---|---|
stroke | Style | The vector object to interpolate the stroke style with. | |
t | number | The factor to interpolate the stroke style by. | |
x | number | | <optional> | The image's top left corner x-coordinate. It must be provided if the stroke style contains an image or different kinds of gradients. |
y | number | | <optional> | The image's top left corner y-coordinate. It must be provided if the stroke style contains an image or different kinds of gradients. |
width | number | | <optional> | The image's rendering width. It must be provided if the stroke style contains an image or different kinds of gradients. |
height | number | | <optional> | The image's rendering height. It must be provided if the stroke style contains an image or different kinds of gradients. |
data_width | number | | <optional> | The image's number of pixels in a row. It must be provided if the stroke style contains an image or different kinds of gradients. |
data_height | number | | <optional> | The image's number of pixels in a column. It must be provided if the stroke style contains an image or different kinds of gradients. |
recursive | boolean | | <optional> | Whether to apply the interpolate stroke operation to the children of the vector object, default is true. |
- Source
The vector object being built with the interpolate stroke operation.
- Type:
- VectorObjectBuilder
line_to(p) → {VectorObjectBuilder}
Draws a line from the current drawing point to the given Point2D.
Name | Type | Description |
---|---|---|
p | Point2D | The point to draw a line to. |
- Source
The vector object being built with the line to operation.
- Type:
- VectorObjectBuilder
match_style_properties(vector_object_builder) → {VectorObjectBuilder}
Matches the style properties of the VectorObjectBuilder with another VectorObject.
Name | Type | Description |
---|---|---|
vector_object_builder | VectorObjectBuilder | The vector object to match the style properties of. |
- Source
The vector object being built with the match style properties operation.
- Type:
- VectorObjectBuilder
move_point(point) → {VectorObjectBuilder}
Moves the current drawing point to the given Point2D.
Name | Type | Description |
---|---|---|
point | Point2D | The point to start a new bezier curve at. |
- Source
The vector object being built with the move point operation.
- Type:
- VectorObjectBuilder
move_to(point, recursiveopt) → {VectorObjectBuilder}
Centers the VectorObjectBuilder at the given Point2D.
Name | Type | Attributes | Description |
---|---|---|---|
point | Point2D | The point to center the vector object at. | |
recursive | boolean | | <optional> | Whether to apply the move to operation to the children of the vector object. |
- Source
The vector object being built with the move to operation.
- Type:
- VectorObjectBuilder
next_to_other(other, directionopt, buffopt, aligned_edgeopt, recursiveopt) → {VectorObjectBuilder}
Puts the VectorObjectBuilder next to the given VectorObjectBuilder at the given direction, with a buff distance between them and aligning at the given edge.
Name | Type | Attributes | Description |
---|---|---|---|
other | VectorObjectBuilder | The other vector object to translate the vector object to. | |
direction | Point2D | | <optional> | The direction to translate the vector object in. If not given, the vector object will be at the right of the other vector object, default is right. |
buff | number | | <optional> | The buffer to leave between the vector object and the other vector object. If not given, the vector object will be touching the other vector object, default is 0. |
aligned_edge | Point2D | | <optional> | The edge of the vector object to align with the other vector object. If not given, the vector object will be aligned at the middle, default is the middle. |
recursive | boolean | | <optional> | Whether to apply the next to other operation to the children of the vector object. If not given, the operation will be applied to the children, default is true. |
- Source
The vector object being built with the next to other operation.
- Type:
- VectorObjectBuilder
next_to_point(point, directionopt, buffopt, aligned_edgeopt, recursiveopt) → {VectorObjectBuilder}
Puts the VectorObjectBuilder next to the given Point2D at the given direction, with a buff distance between them and aligning at the given edge.
Name | Type | Attributes | Description |
---|---|---|---|
point | Point2D | The point to translate the vector object to. | |
direction | Point2D | | <optional> | The direction to translate the vector object in. If not given, the vector object will be at the right of the point, default is right. |
buff | number | | <optional> | The buffer to leave between the vector object and the point. If not given, the vector object will be touching the point, default is 0. |
aligned_edge | Point2D | | <optional> | The edge of the vector object to align with the point. If not given, the vector object will be aligned at the middle, default is the middle. |
recursive | boolean | | <optional> | Whether to apply the next to point operation to the children of the vector object. If not given, the operation will be applied to the children, default is true. |
- Source
The vector object being built with the next to point operation.
- Type:
- VectorObjectBuilder
pointwise_become_partial(start, end, recursiveopt) → {VectorObjectBuilder}
Trims the path of the VectorObjectBuilder to the given start and end proportions.
Name | Type | Attributes | Description |
---|---|---|---|
start | number | The proportion of the path to start at. | |
end | number | The proportion of the path to end at. | |
recursive | boolean | | <optional> | Whether to apply the pointwise become partial operation to the children of the vector object, default is true |
- Source
- Type:
- VectorObjectBuilder
quadratic_curve_to(p1, p2) → {VectorObjectBuilder}
Draws a quadratic bezier curve from the current drawing point with the given control Point2D and end Point2D.
Name | Type | Description |
---|---|---|
p1 | Point2D | The control point of the quadratic curve. |
p2 | Point2D | The end point of the quadratic curve. |
- Source
The vector object being built with the quadratic curve to operation.
- Type:
- VectorObjectBuilder
remove_child_by_index(index) → {VectorObjectBuilder}
Removes a child from the VectorObjectBuilder given its index.
Name | Type | Description |
---|---|---|
index | number | The index of the child to remove from the vector object. |
- Source
The vector object being built with the remove child by index operation.
- Type:
- VectorObjectBuilder
remove_child_by_name(name) → {VectorObjectBuilder}
Removes a child from the VectorObjectBuilder given its name.
Name | Type | Description |
---|---|---|
name | string | The name of the child to remove from the vector object. |
- Source
The vector object being built with the remove child by name operation.
- Type:
- VectorObjectBuilder
remove_children_at_indices(indices) → {VectorObjectBuilder}
Removes all children with the given indices from the VectorObjectBuilder.
Name | Type | Description |
---|---|---|
indices | Array.<number> | The indices of the children to remove from the vector object. |
- Source
The vector object being built with the remove children at indices operation.
- Type:
- VectorObjectBuilder
remove_children_by_names(names) → {VectorObjectBuilder}
Removes all children with the given names from the VectorObjectBuilder.
Name | Type | Description |
---|---|---|
names | Array.<string> | The names of the children to remove from the vector object. |
- Source
The vector object being built with the remove children by names operation.
- Type:
- VectorObjectBuilder
reverse_path() → {VectorObjectBuilder}
Reverses the path of the VectorObjectBuilder.
- Source
The vector object being built with the reverse path operation.
- Type:
- VectorObjectBuilder
rotate(angle, from_pointopt, recursiveopt) → {VectorObjectBuilder}
Rotates the VectorObjectBuilder by the given angle in radians.
Name | Type | Attributes | Description |
---|---|---|---|
angle | number | The angle in radians to rotate the vector object by. | |
from_point | Point2D | | <optional> | The point to rotate the vector object about, default is the center of the bounding box. |
recursive | boolean | | <optional> | Whether to apply the rotate operation to the children of the vector object, default is true. |
- Source
The vector object being built with the rotate operation.
- Type:
- VectorObjectBuilder
scale(factor_x, factor_y, about_pointopt, recursiveopt) → {VectorObjectBuilder}
Scales the VectorObjectBuilder by the given factor.
Name | Type | Attributes | Description |
---|---|---|---|
factor_x | number | The factor to scale the vector object by. | |
factor_y | number | The factor to scale the vector object by. | |
about_point | Point2D | | <optional> | The point to scale the vector object about. |
recursive | boolean | | <optional> | Whether to apply the scale operation to the children of the vector object, default is true. |
- Source
The vector object being built with the scale operation.
- Type:
- VectorObjectBuilder
scale_to_height(height, stretchopt, about_pointopt, recursiveopt) → {VectorObjectBuilder}
Scales the VectorObjectBuilder to the given height.
Name | Type | Attributes | Description |
---|---|---|---|
height | number | The height to scale the vector object to. | |
stretch | boolean | | <optional> | Whether to stretch the vector object to the given height, default is false. |
about_point | Point2D | | <optional> | The point to scale the vector object about, default is the center of the bounding box. |
recursive | boolean | | <optional> | Whether to apply the scale to height operation to the children of the vector object, default is true. |
- Source
The vector object being built with the scale to height operation.
- Type:
- VectorObjectBuilder
scale_to_width(width, stretchopt, about_pointopt, recursiveopt) → {VectorObjectBuilder}
Scales the VectorObjectBuilder to the given width.
Name | Type | Attributes | Description |
---|---|---|---|
width | number | The width to scale the vector object to. | |
stretch | boolean | | <optional> | Whether to stretch the vector object to the given width, default is false. |
about_point | Point2D | | <optional> | The point to scale the vector object about, default is the center of the bounding box. |
recursive | boolean | | <optional> | Whether to apply the scale to width operation to the children of the vector object, default is true. |
- Source
The vector object being built with the scale to width operation.
- Type:
- VectorObjectBuilder
set_actual_path(actual_path) → {VectorObjectBuilder}
Sets the actual path of the VectorObjectBuilder. Actual path is the path that is drawn with its transformation matrix applied.
Name | Type | Description |
---|---|---|
actual_path | Path2D | The path to set the vector object to. |
- Source
The vector object being built with the set actual path operation.
- Type:
- VectorObjectBuilder
set_children(children) → {VectorObjectBuilder}
Sets the children of the VectorObjectBuilder.
Name | Type | Description |
---|---|---|
children | Array.<VectorObjectBuilder> | The children to set the vector object to. |
- Source
The vector object being built with the set children operation.
- Type:
- VectorObjectBuilder
set_fill(fill, recursiveopt) → {VectorObjectBuilder}
Sets the fill Style of the VectorObjectBuilder.
Name | Type | Attributes | Description |
---|---|---|---|
fill | Style | The fill style to set the vector object to. | |
recursive | boolean | | <optional> | Whether to apply the set fill operation to the children of the vector object, default is true. |
- Source
The vector object being built with the set fill operation.
- Type:
- VectorObjectBuilder
set_fill_rule(fill_rule, recursiveopt) → {VectorObjectBuilder}
Sets the fill rule of the VectorObjectBuilder.
Name | Type | Attributes | Description |
---|---|---|---|
fill_rule | string | The fill rule to set the vector object to. | |
recursive | boolean | | <optional> | Whether to apply the set fill rule operation to the children of the vector object, default is true. |
- Source
The vector object being built with the set fill rule operation.
- Type:
- VectorObjectBuilder
set_name(nameopt) → {VectorObjectBuilder}
Sets the name of the VectorObjectBuilder.
Name | Type | Attributes | Description |
---|---|---|---|
name | string | | <optional> | The name to set the vector object to. |
- Source
The vector object being built with the set name operation.
- Type:
- VectorObjectBuilder
set_path(path) → {VectorObjectBuilder}
Sets the Path2D of the VectorObjectBuilder.
Name | Type | Description |
---|---|---|
path | Path2D | The path to set the vector object to. |
- Source
The vector object being built with the set path operation.
- Type:
- VectorObjectBuilder
set_slice_children(start, end, children) → {VectorObjectBuilder}
Sets the children from the start index to the end index of the VectorObjectBuilder.
Name | Type | Description |
---|---|---|
start | number | The start index of the children to replace. |
end | number | The end index of the children to replace. |
children | Array.<VectorObjectBuilder> | The children to replace the children from the start index to the end index with. |
- Source
The vector object being built with the set slice children operation.
- Type:
- VectorObjectBuilder
set_stroke(stroke, recursiveopt) → {VectorObjectBuilder}
Sets the stroke Style of the VectorObjectBuilder.
Name | Type | Attributes | Description |
---|---|---|---|
stroke | Style | The stroke style to set the vector object to. | |
recursive | boolean | | <optional> | Whether to apply the set stroke operation to the children of the vector object, default is true. |
- Source
The vector object being built with the set stroke operation.
- Type:
- VectorObjectBuilder
set_stroke_dash_array(stroke_dash_array, recursiveopt) → {VectorObjectBuilder}
Sets the stroke dash array of the VectorObjectBuilder.
Name | Type | Attributes | Description |
---|---|---|---|
stroke_dash_array | Array.<number> | The stroke dash array to set the vector object to. | |
recursive | boolean | | <optional> | Whether to apply the set stroke dash array operation to the children of the vector object, default is true. |
- Source
The vector object being built with the set stroke dash array operation.
- Type:
- VectorObjectBuilder
set_stroke_dash_offset(stroke_dash_offset, recursiveopt) → {VectorObjectBuilder}
Sets the stroke dash offset of the VectorObjectBuilder.
Name | Type | Attributes | Description |
---|---|---|---|
stroke_dash_offset | number | The stroke dash offset to set the vector object to. | |
recursive | boolean | | <optional> | Whether to apply the set stroke dash offset operation to the children of the vector object, default is true. |
- Source
The vector object being built with the set stroke dash offset operation.
- Type:
- VectorObjectBuilder
set_stroke_line_cap(stroke_line_cap, recursiveopt) → {VectorObjectBuilder}
Sets the stroke line cap of the VectorObjectBuilder.
Name | Type | Attributes | Description |
---|---|---|---|
stroke_line_cap | string | The stroke line cap to set the vector object to. | |
recursive | boolean | | <optional> | Whether to apply the set stroke line cap operation to the children of the vector object, default is true. |
- Source
The vector object being built with the set stroke line cap operation.
- Type:
- VectorObjectBuilder
set_stroke_line_join(stroke_line_join, recursiveopt) → {VectorObjectBuilder}
Sets the stroke line join of the VectorObjectBuilder.
Name | Type | Attributes | Description |
---|---|---|---|
stroke_line_join | string | The stroke line join to set the vector object to. | |
recursive | boolean | | <optional> | Whether to apply the set stroke line join operation to the children of the vector object, default is true. |
- Source
The vector object being built with the set stroke line join operation.
- Type:
- VectorObjectBuilder
set_stroke_miter_limit(stroke_miter_limit, recursiveopt) → {VectorObjectBuilder}
Sets the stroke miter limit of the VectorObjectBuilder.
Name | Type | Attributes | Description |
---|---|---|---|
stroke_miter_limit | number | The stroke miter limit to set the vector object to. | |
recursive | boolean | | <optional> | Whether to apply the set stroke miter limit operation to the children of the vector object, default is true. |
- Source
The vector object being built with the set stroke miter limit operation.
- Type:
- VectorObjectBuilder
set_stroke_width(stroke_width, recursiveopt) → {VectorObjectBuilder}
Sets the stroke width of the VectorObjectBuilder.
Name | Type | Attributes | Description |
---|---|---|---|
stroke_width | number | The stroke width to set the vector object to. | |
recursive | boolean | | <optional> | Whether to apply the set stroke width operation to the children of the vector object, default is true. |
- Source
The vector object being built with the set stroke width operation.
- Type:
- VectorObjectBuilder
set_transform(matrix, recursiveopt) → {VectorObjectBuilder}
Sets the TransformationMatrix of the VectorObjectBuilder.
Name | Type | Attributes | Description |
---|---|---|---|
matrix | TransformationMatrix | The matrix in CSS format to transform the vector object by. | |
recursive | boolean | | <optional> | Whether to apply the transform operation to the children of the vector object. |
- Source
The vector object being built with the transform operation.
- Type:
- VectorObjectBuilder
shift(dx, dy, recursiveopt) → {VectorObjectBuilder}
Shifts the VectorObjectBuilder by the given dx and dy.
Name | Type | Attributes | Description |
---|---|---|---|
dx | number | The x-coordinate to translate the vector object by. | |
dy | number | The y-coordinate to translate the vector object by. | |
recursive | boolean | | <optional> | Whether to apply the shift operation to the children of the vector object, default is true. |
- Source
The vector object being built with the shift operation.
- Type:
- VectorObjectBuilder
(static) default_tip_shape(tip_length) → {VectorObjectBuilder}
Returns the default tip shape pointing to the right and centered at the origin as a VectorObjectBuilder.
Name | Type | Description |
---|---|---|
tip_length | number | The length of the tip shape. |
- Source
The default tip shape pointing to the right and centered at the origin.
- Type:
- VectorObjectBuilder
(static) default_vector_object_builder() → {VectorObjectBuilder}
Creates a VectorObjectBuilder representing an empty VectorObject.
- Source
A new vector object builder representing an empty vector object.
- Type:
- VectorObjectBuilder
(static) from_svg(svg, font_facesopt, image_libraryopt) → {VectorObjectBuilder}
Creates a new VectorObjectBuilder from an SVG string.
Name | Type | Attributes | Description |
---|---|---|---|
svg | string | The SVG string to create the vector object builder from. | |
font_faces | Array.<FontFace> | | <optional> | Data from font faces to use for text rendering. |
image_library | ImageLibrary | | <optional> | Image library to use for image rendering. |
- Source
A new vector object builder.
- Type:
- VectorObjectBuilder