Import / export SVG
svg() as getter
returns
string
Exporting the full generated SVG, or a part of it, can be done with the svg()
method:
draw.svg()
Exporting works on individual elements as well:
var rect = draw.rect()
var svg = rect.svg()
svg() as setter
returns
itself
Importing is done with the same method by passing a string of svg as the first argument:
draw.svg('<g><rect width="100" height="50" fill="#f06"></rect></g>')
Importing works on any element that inherits from SVG.Parent
, which is basically every element that can contain other elements.