使用Adobe Illustrator创建SVG路径,使用“移动到”命令。

6
当您将Adobe Illustrator文件导出为SVG格式时,路径会使用SVG路径语法进行编码:

http://www.w3.org/TR/SVG/paths.html

如果您查看“路径数据”元素,可能会将“移动到”命令嵌入到路径中:

http://www.w3.org/TR/SVG/paths.html#PathData

换句话说,您可以在路径上画几条线,拿起笔并将其移动到其他位置,然后继续相同的路径。
我一直在尝试在Illustrator中做到这一点,但没有成功。您可以添加到现有路径,但似乎只能通过从其中一个端点延伸路径来实现。我不想这样做:我想从其他地方继续路径。
通过组合两个不相交的路径,您可以获得类似于此的东西。但是,当Illustrator进行svg导出时,它只会创建两个
2个回答

7
我认为唯一的方法是创建一个复合路径。选择您想要作为单个路径使用的两条路径,然后转到“对象”>“复合路径”>“创建”。
如果这样做不起作用,那么可能是不可能的。这是我所能想到的在AI看来非连续路径存在的唯一方式。

3
  1. Create a file that has a path using move-to commands:

    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <svg xmlns="http://www.w3.org/2000/svg" version="1.1"
         viewBox="-25 -25 100 100">
      <path d="M0,0 L50,0 M50,50 L0,50" stroke="black" />
    </svg>
    
  2. Open this file in Illustrator. Note that there is a single element named <Compound Path> in the Layers palette.

  3. Choose command Object > Compound Path > Release. Now there are two paths selected.

  4. Choose command Object > Compound Path > Make.

  5. Save as SVG file:

    <?xml version="1.0" encoding="utf-8"?>
    <!-- Generator: Adobe Illustrator 15.0.2, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
    <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
      "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
    <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" 
         xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
         width="612px" height="792px" viewBox="0 0 612 792"
         enable-background="new 0 0 612 792" xml:space="preserve">
      <path stroke="#000000" d="M128,218h306 M434,524H128"/>
    </svg>
    
  6. Cheer!


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接