SVGAnimatedAngle: animVal 属性
animVal
是 SVGAnimatedAngle
接口的一个只读属性,代表 SVG 元素上关联的 <angle>
的当前动画值。如果该属性当前未被动画化,则 animVal
将与 baseVal
相同。
此属性反映了 SVG <marker>
元素中正在动画化的 orient
属性的角度的动画状态,从而在动画期间提供对角度值的访问。
值
一个 SVGAngle
对象,表示 <angle>
内容类型的动画值。
- 如果角度正在被动画化,
animVal
将反映当前的动画状态。 - 如果角度未被动画化,
animVal
将与SVGAnimatedAngle.baseVal
完全相同。
示例
js
const marker = document.querySelector("[orient]");
// Set an initial angle for the orient attribute
marker.setAttribute("orient", "45");
// Access the animated value of the angle
const animAngle = marker.orientAngle.animVal; // an SVGAngle object
console.log(animAngle.value); // Output: 45 (current animated value of the angle)
console.log(animAngle.unitType); // Output: 2 (constant for SVG_ANGLETYPE_DEG)
规范
规范 |
---|
Scalable Vector Graphics (SVG) 2 # __svg__SVGAnimatedAngle__animVal |
浏览器兼容性
加载中…