Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery SVG nested groups

I need to generate an SVG nested group with jQuerySVG or RaphaëlJS. The latter doesn't support groups, so I chose the former.

What I need:

<g transform="translate(300, 300)">
    <line x1="0" y1="0" x2="0" y2="-100" />
    <g transform="translate(0, -100) rotate(20)">
        <line x1="0" y1="0" x2="0" y2="-100" />
    </g>
</g>

The website is down at the moment, but checking the web archive for documentation I can't find a way to give an element two different groups:

svg.line(g, 10, 80, 140, 70);

I'm looking for something like:

svg.line(g, g2, 10, 80, 140, 70);

Any different approach?

Thanks

like image 318
Shirak Avatar asked Feb 06 '26 20:02

Shirak


1 Answers

According to doc you can do this:

g = svg.group();
g2 = svg.group(g);
svg.line(g, 10, 80, 140, 70);
svg.line(g2, 10, 80, 140, 70); 
like image 134
bjornd Avatar answered Feb 09 '26 10:02

bjornd



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!