我不知道如何在 JavaScript 中从 SVG 元素设置 x1、y1、x2、y2 参数。
<svg height="210" width="500">
<line id="line" x1="0" y1="0" x2="200" y2="200" style="stroke:rgb(255,0,0);stroke-width:2" />
</svg>
感谢您的帮助。
最佳答案
只是
var line = document.getElementById("line");
line.setAttribute("x1", "5");
等等
关于javascript - 如何使用 javascript 移动 SVG 线,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24975475/