Bye Bye Moore

PoCソルジャーな零細事業主が作業メモを残すブログ

Node-RedでSVGを描画する その2:変数の受取による動的変化

shuzo-kino.hateblo.jp
の続き。
前回のでは直接記述でしたが、今回はこれに変数経由でパラメータを送り込むように作ってみます。

実際のところ

他のノードと同様、変数は"{{msg.payload}}"のような感じで与えます。

<svg x="0" y="0" height="100" viewBox="0 0 100 100" width="100" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Add here your SVG shapes (circles, rectangles, ...) -->
<circle cx="50" cy="50" r="{{msg.payload}}" fill="red" stroke="red" stroke-width="4px" />
<!-- Or remove everything, if you want to paste an entire drawing (<svg...>...</svg>).-->
</svg>

スライダーを動かすと