# line

The line element is an SVG basic shape used to create a line connecting two points.

Usually, this element is create with:

const line = parentElement.add('line')

It's possible create as a disconnected element with gySVG('line') and attach it to the SVG document with .attachTo().

More info: mdn (opens new window) | w3c (opens new window)

# .x1()

line.x1( _ )

Set defines the x-axis coordinate of the line starting point.

  • argument: {} _

  • returns: {gySVGObject} The original object

const x1 = element.x1();

Get the x1 current value.

  • returns: {}

# .x2()

line.x2( _ )

Set defines the x-axis coordinate of the line ending point.

  • argument: {} _

  • returns: {gySVGObject} The original object

const x2 = element.x2();

Get the x2 current value.

  • returns: {}

# .y1()

line.y1( _ )

Set defines the y-axis coordinate of the line starting point.

  • argument: {} _

  • returns: {gySVGObject} The original object

const y1 = element.y1();

Get the y1 current value.

  • returns: {}

# .y2()

line.y2( _ )

Set defines the y-axis coordinate of the line ending point.

  • argument: {} _

  • returns: {gySVGObject} The original object

const y2 = element.y2();

Get the y2 current value.

  • returns: {}

# .pathLength()

line.pathLength( _ )

Set defines the total path length in user units.

  • argument: {} _

  • returns: {gySVGObject} The original object

const pathLength = element.pathLength();

Get the pathLength current value.