animated SVG + cross browser compatibility

前端 未结 1 618
伪装坚强ぢ
伪装坚强ぢ 2021-01-27 15:23

I\'m having trouble with an animated SVG I created using http://lazylinepainter.info/

On Chrome it works perfectly. However on Safari, Firefox and iOS the animation sho

相关标签:
1条回答
  • 2021-01-27 15:49

    This seems to be a bug in FF (IMO anyway). It should not be drawing the line endcaps if the line ends exactly at a dash endpoint.

    One quick fix is to change your stroke-caps to "butt".

    'strokeCap': 'butt',
    

    This works on Firefox at least. I can't test whether this works on Safari.

    If you want to keep the round caps, then a workaround is to make sure that the lines don't start and end exactly on a dasharray endpoint. Change these two lines in the paint() function.

    path.style.strokeDasharray = length + ' ' + (length+2);
    path.style.strokeDashoffset = (length+1);
    

    http://jsfiddle.net/aqn6zkf4/3/

    0 讨论(0)
提交回复
热议问题