开发者

Shard SVG image into pieces

开发者 https://www.devze.com 2023-02-04 18:08 出处:网络
Say you have aSVG image such as this: Each card is its own svg group, but cont开发者_运维问答ains other groups of subelements.

Say you have a SVG image such as this:

Shard SVG image into pieces

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)
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号