SVGEllipseElement
Baseline
Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
Giao diện SVGEllipseElement cung cấp quyền truy cập vào các thuộc tính của phần tử <ellipse>.
Thuộc tính phiên bản
Kế thừa phương thức từ giao diện cha, SVGGeometryElement.
SVGEllipseElement.cxRead only-
Thuộc tính này trả về một
SVGAnimatedLengthphản ánh thuộc tínhcxcủa phần tử<ellipse>đã cho. SVGEllipseElement.cyRead only-
Thuộc tính này trả về một
SVGAnimatedLengthphản ánh thuộc tínhcycủa phần tử<ellipse>đã cho. SVGEllipseElement.rxRead only-
Thuộc tính này trả về một
SVGAnimatedLengthphản ánh thuộc tínhrxcủa phần tử<ellipse>đã cho. SVGEllipseElement.ryRead only-
Thuộc tính này trả về một
SVGAnimatedLengthphản ánh thuộc tínhrycủa phần tử<ellipse>đã cho.
Phương thức phiên bản
Kế thừa phương thức từ giao diện cha, SVGGeometryElement.
Ví dụ
>SVG
<svg width="200" height="200" xmlns="http://www.w3.org/2000/svg">
<ellipse cx="100" cy="100" rx="100" ry="60" id="ellipse" />
</svg>
JavaScript
const ellipse = document.getElementById("ellipse");
function outputSize() {
// Outputs "horizontal radius: 100 vertical radius: 60"
console.log(
`horizontal radius: ${ellipse.rx.baseVal.valueAsString}`,
`vertical radius: ${ellipse.ry.baseVal.valueAsString}`,
);
}
ellipse.addEventListener("click", outputSize);
Kết quả
Thông số kỹ thuật
| Specification |
|---|
| Scalable Vector Graphics (SVG) 2> # InterfaceSVGEllipseElement> |
Tương thích trình duyệt
Xem thêm
- Phần tử SVG
<ellipse>