在我的应用程序之一,我创建与下面的代码扩展SVG路径
var points="M1180,401 S1180,476 1030 476 L100, 476";
createPath(points, id, name);
function createPath(points, id, nane) {
var shape = document.createElementNS(svgNS, "path");
shape.setAttributeNS(null, "d", points);
shape.setAttributeNS(null, "class", "path");
shape.setAttributeNS(null, "id", id);
document.getElementById("holder").appendChild(shape);
return id;
}
一个SVG路径,这将在我的SVG创建路径(命名为“持有人”)。进一步在按钮按下事件我需要延长其长度。由于SVG中有多条路径,所以我们不能拿它的点。
请帮 感谢
请解释你的意思是“延长其长度” - 在任何特定的方向,变换/拉伸路径,或其他? –
嗨,现在我画的线仍然是x 100,y 476 ...我需要将它延伸到x -250,y 476 – ramesh