I understand that the first path in a SVG should always begin with M. (ie. an absolute move to command)
Say there are multiple paths in a single SVG, though. Can additional paths start with m (i.e. the relative move to command) in order to start at the endpoint of the previous path?
I know that this is possible simply by moving the data of the second path onto the end of the first path, but in my situation this is not possible.
Thank you for any help!
Relative (lowercase m) moveto's at the start of a path will be interpreted as an absolute (uppercase M) moveto, although subsequent coordinate pairs after the initial two will be treated as relative lineto's. They will not be treated as an indication to start drawing at the end of the previous path command. From the spec:
Start a new sub-path at the given (x,y) coordinate.
M(uppercase) indicates that absolute coordinates will follow;m(lowercase) indicates that relative coordinates will follow. If a moveto is followed by multiple pairs of coordinates, the subsequent pairs are treated as implicit lineto commands. Hence, implicit lineto commands will be relative if the moveto is relative, and absolute if the moveto is absolute. If a relative moveto (m) appears as the first element of the path, then it is treated as a pair of absolute coordinates. In this case, subsequent pairs of coordinates are treated as relative even though the initial moveto is interpreted as an absolute moveto.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With