The animVal
property of the SVGAnimatedEnumeration
interface contains the current value of an SVG enumeration. If there is no animation, it is the same value as the baseVal
.
The animVal
property of the SVGAnimatedEnumeration
interface contains the current value of an SVG enumeration. If there is no animation, it is the same value as the baseVal
.
An integer containing the current value of the enumeration
html
<div> <svg viewBox="0 0 100 100" width="200" height="200"> <clipPath id="clip1" clipPathUnits="userSpaceOnUse"> <animate attributeName="clipPathUnits" values="userSpaceOnUse;objectBoundingBox;userSpaceOnUse" dur="2s" repeatCount="indefinite" /> <circle cx="50" cy="50" r="25" /> </clipPath> <rect id="r1" x="0" y="0" width="50" height="100" /> <use clip-path="url(#clip1)" href="#r1" fill="lightblue" /> </svg> </div> <pre id="log"></pre>
js
const clipPath1 = document.getElementById("clip1"); const log = document.getElementById("log"); function displayLog() { const animValue = clipPath1.clipPathUnits.animVal; const baseValue = clipPath1.clipPathUnits.baseVal; log.textContent = `The 'clipPathUnits.animVal' is ${animValue}.\n`; log.textContent += `The 'clipPathUnits.baseVal' is ${baseValue}.`; requestAnimationFrame(displayLog); } displayLog();
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
animVal |
1 | 12 | 1.5 | 9 | ≤12.1 | 3 | 3 | 18 | 4 | ≤12.1 | 1 | 1.0 |
© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/SVGAnimatedEnumeration/animVal