Constructor
new Line(stroke, opacity, xopt, yopt, point1opt, point2opt)
Creates an instance of a Line shape.
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
stroke | Stroke | A border of the shape. | ||
opacity | number | 1 | Opacity of the shape (0 to 1). | |
x | number | <optional> | 0 | Horizontal position from the left edge. |
y | number | <optional> | 0 | Vertical position from the top edge. |
point1 | number | <optional> | An object with X and Y coordinates {x: number, y: number}. | |
point2 | number | <optional> | An object with X and Y coordinates {x: number, y: number}. |
- See
Classes
Methods
point1(x, yopt) → {Line}
Sets or gets the first point of the line.
| Name | Type | Attributes | Description |
|---|---|---|---|
x | number | | X coordinate of the point, or an object with X and Y coordinates {x: number, y: number}. | |
y | number | <optional> | Y coordinate of the point (required only if |
If called without parameters, returns current point; otherwise returns this Line shape for chaining.
- Type:
- Line
point2(x, yopt) → {Line}
Sets or gets the second point of the line.
| Name | Type | Attributes | Description |
|---|---|---|---|
x | number | | X coordinate of the point, or an object with X and Y coordinates {x: number, y: number}. | |
y | number | <optional> | Y coordinate of the point (required only if |
If called without parameters, returns current point; otherwise returns this Line shape for chaining.
- Type:
- Line
toObject(includeopt) → {object}
Returns a JSON object that contains this shape properties. It may be converted back to this shape.
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
include | string | <optional> | "all" | Specified what to include. "all" is default. Valid values are: "all", "stroke", "background", "points", "basic". |
Returns an object containing this shape's properties.
- Type:
- object