【发布时间】:2017-12-24 18:33:20
【问题描述】:
我想用 SVG 画一个圆。圆的中心在数组中。 arr[i][0].x 是 x 中心,arr[i][0].y 是 y 中心,arr[i][0].r 是半径。
我试过这样
svg.appendChild(circle);
circle.cx.appendItem(arr[i][0].x);
circle.cy.appendItem(arr[i][0].y);
circle.r.appendItem(arr[i][0].r);
但它不起作用。我该如何解决?
【问题讨论】:
-
也许
appendChild(circle)等结束,在定义了它的属性之后? -
@JeremyThille 使用
setAttribute -
@JeremyThille 顺序无关紧要。
标签: javascript svg