KUTE.js svg 路径不变形

KUTE.js svg paths not morphing

Here is a codepen i made.

如您所见,路径没有变形。 我已经得出结论,问题出在 svg 本身,它们没有变形。 这可能是什么问题?形状非常简单,都具有相同的大小和锚点,正如它在 kute.js documentation、"closed shapes (their d attribute ends with 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;
  }

Codepen demo.