Embedding SVG in SVG

I could not find a way to embed two SVGs in an SVG document. I need to do this with the possibility of code that will manipulate both child SVG-s and independent coordinates on both of these areas. I do not like to do this in HTML, because I find it too restrictive compared to SVG. Thank you very much!

+4
source share
3 answers

A fragment of an SVG document consists of any number of SVG elements contained in an svg element.

Basically:

<svg …> <svg id="a" …></svg> <svg id="b" …></svg> </svg> 
+5
source
 <svg> ... <image x="..." y="..." width="..." height="..." xlink:href="path/to/your/file.svg" ></image> ... </svg> 
+1
source

One solution is the structure of [parent svg] - [g] - [child svg].

 <svg> <g transform="translate(-,-)"> <svg> ... </svg> </g> </svg> 

You can set the sinal of the child svg as a translation of the g element.

demo:
http://hitokun-s.imtqy.com/demo/path-between-two-svg.html

0
source

Source: https://habr.com/ru/post/1379891/


All Articles