【发布时间】:2018-03-14 09:38:20
【问题描述】:
我需要在两个圆的中心之间画一条对称曲线。
<svg>
<circle class="spot" id="au" cx="1680" cy="700" r="0"></circle>
<circle class="spot" id="sl" cx="1425" cy="525" r="0"></circle>
<line id="line1" stroke-width="2" stroke="red"/>
</svg>
这是我目前写的代码。
function drawNow() {
let point1X = document.getElementById("au").getAttribute("cx");
let point1Y = document.getElementById("au").getAttribute("cy");
let point2X = document.getElementById("sl").getAttribute("cx");
let point2Y = document.getElementById("sl").getAttribute("cy");
let line1 = document.getElementById("line1");
line1.setAttribute("x1", point1X);
line1.setAttribute("y1", point1Y);
line1.setAttribute("x2", point2X);
line1.setAttribute("y2", point2Y);
}
【问题讨论】:
标签: javascript svg bezier curve