Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a command to move the whole SVG path to a new position?

Tags:

javascript

svg

Is there a command to move the whole SVG path to a new position, instead of adding the offsets to each point of the path?

like image 536
powerboy Avatar asked Oct 01 '11 22:10

powerboy


People also ask

How do I change position in SVG?

Changing the “x” and “y” attributes of the second “<svg>” element also changes the placement of all included shapes. In contrast to the “<g>” element, the nested “<svg>” elements allow you to change the position of multiple shapes at once.

What is M in SVG path?

SVG Path - <path> M = moveto. L = lineto. H = horizontal lineto. V = vertical lineto.

What is Moveto SVG?

The "moveto" commands. The "moveto" commands (M or m) must establish a new initial point and a new current point. The effect is as if the "pen" were lifted and moved to a new location. A path data segment (if there is one) must begin with a "moveto" command.

What is d attribute in path?

The d attribute defines a path to be drawn. A path definition is a list of path commands where each command is composed of a command letter and numbers that represent the command parameters. The commands are detailed below. You can use this attribute with the following SVG elements: <path> , <glyph> , <missing-glyph> .


1 Answers

Thanks to sehe's comment. The solution is: wrap the path into

<g transform="translate(offset_x,offset_y)"></g>
like image 106
powerboy Avatar answered Nov 15 '22 18:11

powerboy