如何向绘制的元素添加笔画 属性?
How can I add a stroke property to a drawn element?
我有一个函数可以在我的 svg 元素上绘制圆圈:
function drawCircle( pElem, pX, pY)
{
pElem.circle( 7 ).fill( '#00FF00' ).move( pX, pY );
} //drawCircle
但是我想像这样给绘制的元素添加黑色描边:
function drawCircle( pElem, pX, pY)
{
pElem.circle( 7 ).fill( '#00FF00' ).move( pX, pY ).style.stroke = 'black'; //tried this but it didn't work
} //drawCircle
我该怎么做?
(注意:我正在使用 svg.js 库)
API doc一共提到了五种可能:
.stroke('#000') // seems hex notation is expected
.attr('stroke', 'black')
.attr({stroke: 'black'})
.style('stroke', 'black')
.style({stroke: 'black'})
我有一个函数可以在我的 svg 元素上绘制圆圈:
function drawCircle( pElem, pX, pY)
{
pElem.circle( 7 ).fill( '#00FF00' ).move( pX, pY );
} //drawCircle
但是我想像这样给绘制的元素添加黑色描边:
function drawCircle( pElem, pX, pY)
{
pElem.circle( 7 ).fill( '#00FF00' ).move( pX, pY ).style.stroke = 'black'; //tried this but it didn't work
} //drawCircle
我该怎么做? (注意:我正在使用 svg.js 库)
API doc一共提到了五种可能:
.stroke('#000') // seems hex notation is expected
.attr('stroke', 'black')
.attr({stroke: 'black'})
.style('stroke', 'black')
.style({stroke: 'black'})