如您所见,路径没有变形。 我已经得出结论,问题出在 svg 本身,它们没有变形。 这可能是什么问题?这些形状非常简单,都具有相同的尺寸和 anchor ,正如 kute.js documentation 上所述。 ,“闭合形状(它们的 d 属性以 z 结尾)。”
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 600 600" >
<path id="n1" fill="orangered" d="M62,7.5l210,20l30,230l-290-60L62,7.5z"/>
<path id="n2" style="visibility:hidden" d="M0,7.5l315,32l-31,189l-280,31L0,7.5"/>
</svg>
最佳答案
最新版本fixes问题。该插件不处理两个多边形具有相同点数的情况。
有问题的代码
if ( s.length !== e.length ){
arL = Math.max(s.length,e.length);
if ( arL === e.length) { sm = s; lg = e; } else { sm = e; lg = s; }
sml = sm.length;
smp = S.cP('M'+sm.join('L')+'z'); len = smp.getTotalLength() / arL;
for (var i=0; i<arL; i++){
tl = smp.getPointAtLength(len*i);
cs = S.gCP(len,tl,sm);
nsm.push( [ cs[0], cs[1] ] );
}
if (arL === e.length) { e1 = lg; s1 = nsm; } else { s1 = lg; e1 = nsm; }
} else { // here we know the paths have same number of points
s1 = s; e1 = e;
}
关于javascript - KUTE.js svg 路径不变形,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39043374/