# path

The path SVG element is the generic element to define a shape. All the basic shapes can be created with a path element.

Usually, this element is created with:

const path = parentElement.add('path')

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

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

# .d()

path.d( value )

Set this attribute defines the shape of the path.

  • argument: {Array|string} value The d value

  • returns: {gySVGObject} The original object

const d = element.d();

Get the d current value.

  • returns: {Array|string}

# .pathLength()

path.pathLength( length )

Set this attribute lets authors specify the total length for the path, in user units.

  • argument: {number} length The path length

  • returns: {gySVGObject} The original object

const pathLength = element.pathLength();

Get the pathLength current value.