SVGAnimatedEnumeration
SVGAnimatedEnumeration 介面描述了那些屬於特定列舉常量並且可以被動畫化的屬性值。
例項屬性
例項方法
SVGAnimatedEnumeration 介面不提供任何特定方法。
示例
考慮這段帶有 <clipPath> 元素的示例:它的 clipPathUnits 與一個 SVGAnimatedEnumeration 物件相關聯。
html
<svg viewBox="0 0 100 100" width="200" height="200">
<clipPath id="clip1" clipPathUnits="userSpaceOnUse">
<circle cx="50" cy="50" r="35" />
</clipPath>
<!-- Some reference rect to materialized to clip path -->
<rect id="r1" x="0" y="0" width="45" height="45" />
</svg>
這段示例獲取元素,並記錄 SVGClipPathElement.clipPathUnits 屬性的 baseVal 和 animVal。由於沒有動畫發生,它們具有相同的值。
js
const clipPathElt = document.getElementById("clip1");
console.log(clipPathElt.clipPathUnits.baseVal); // Logs 1 that correspond to userSpaceOnUse
console.log(clipPathElt.clipPathUnits.animVal); // Logs 1 that correspond to userSpaceOnUse
規範
| 規範 |
|---|
| Scalable Vector Graphics (SVG) 2 # 介面SVGAnimatedEnumeration |
瀏覽器相容性
載入中…