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 |
浏览器兼容性
加载中…