how to use attr's stroke-dasharray,stroke-linecap,stroke-linejoin in raphaeljs

后端 未结 4 1864
醉话见心
醉话见心 2020-12-08 08:31

Can anyone give me an example of these attributes in action: stroke-dasharray, stroke-linecap, stroke-linejoin i tried using them, but i don\'t quite understand the sente

4条回答
  •  攒了一身酷
    2020-12-08 08:50

    If you want to apply a dashed line in a standard SVG way on a Raphael line object, this worked well for me; whereas I didn't have any luck using period and hyphens as done in the Raphael way.

    myLine.attr({stroke:'green'}).node.setAttribute('stroke-dasharray', '10,10');
    

    The parameters (10,10 in this example) are the length,gap and you can iterate that as much as you want. Like 5, 5, 1, 5 would be shorter dashes with dots.

    Reference: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-dasharray

提交回复
热议问题