SVG def中的动态文本

时间:2018-02-18 18:35:50

标签: html svg text dynamic

我正在尝试使用svg def标签以创造性的方式显示某些维度。

举个例子,我有以下示例svg def。

    <svg>
    <defs>
        <g id="aaa" stroke-opacity="null" stroke-width="0"  stroke-linecap="null"  stroke-linejoin="null" fill="#6bfc46" >
             <circle cx="300" cy="400" r="30" />
             <rect x="300" y="400" width="30" height="30" />
             <circle cx="300" cy="400" r="25" fill="#ffffff" />
             <text x="300" y="400" text-anchor="middle" stroke="#6bfc46" stroke-width="2px" dy=".3em">5</text>  
        </g>
    </defs>
    <svg/>   

我需要实现的是我应该能够在不同位置使用此定义的文本,如下所示。

<use xlink:href="#aaa" x="480" y="550" changing_text="3">
<use xlink:href="#aaa" x="580" y="650" changing_text="9">

我的问题是

1)这可以用SVG吗?

2)我们怎样才能做到这一点?

0 个答案:

没有答案