Shard SVG image into pieces
Say you have a SVG image such as this:
Each card is its own svg group, but cont开发者_运维问答ains other groups of subelements.
How can you split it up into 52 different images?
Assuming each card is in it's own group (<g>
element) with no dependencies outside the group then:
- copy the root svg element of the original file to 52 files (
<svg ...></svg>
) - for each card:
- append the group belonging to the card as a child of the root svg element in one of the new svg files created in step 1.
- update the viewBox attribute (or width and height) on the root svg element to fit the card (can probably be done automatically by svg scour)
精彩评论