JSignage:Line
From SpinetiX Support Wiki
.line()
$.line( attributes );
Returns: jSignage Object
Description
Draws a linear shape / segment that starts at one point and ends at another and must have an outline to be visible. See the line element in the SVG specification for reference.
Parameters
-
attributes
- Type: Plain Object.
- Contains the shape attributes.
Attributes
The following attributes can be specified:
-
stroke
,strokeWidth
etc.- Stroke attributes (common to all shapes). The line is geometrically one-dimensional, so it has no interior, thus it is never filled.
-
x1
,y1
- Type: Number. Default: 0.
- x and y coordinates of start of the line.
-
x2
,y2
- Type: Number. Default: 0.
- x and y coordinates of end of the line.
Examples
// draw a vertical red separator and add it to the document
$.line({ x1: 640, y1:0, x2: 640, y2: 720, stroke: 'red', strokeWidth: 5 }).addTo('svg');
// draw a blue-dashed horizontal line with rounded line caps and add it to the document
$.line({ x1: 80, y1: 400, x2: 1200, y2: 400, stroke: 'blue',
strokeWidth: 20, strokeLineCap: 'round', strokeDashArray: '40, 50'
}).addTo('svg');
Note: See also how to add underlying to text using lines.