Dilate and erode SVG shapes using Javascript

前端 未结 2 1151
面向向阳花
面向向阳花 2021-01-16 18:27

EDIT:

I finally found a way to erode and dilate polygons (offsetting) so that new geometry is created using Clipper library: https://sourceforge.net/projects/jsclipp

2条回答
  •  -上瘾入骨i
    2021-01-16 19:21

    Have you actually tested SVG's native filters? This looks close enough:

    
    
      
        
          
        
        
          
        
          
      
          
      
          
    
    

    There is some clipping going on the dilate filter that can't seem to be resolved by increasing the filter region, but other than that it's pretty close to your illustrator rendering. Sure beats rendering server-side.

    http://jsfiddle.net/5Qv5v/

提交回复
热议问题