SVGAnimatedEnumeration

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since January 2020.

Die SVGAnimatedEnumeration-Schnittstelle beschreibt Attributwerte, die Konstanten aus einer bestimmten Enumeration sind und animiert werden können.

Instanzeigenschaften

baseVal

Ein Ganzzahlwert, der den Basiswert des angegebenen Attributs vor der Anwendung von Animationen darstellt.

animVal

Wenn das angegebene Attribut oder die Eigenschaft animiert wird, enthält es den aktuellen animierten Wert des Attributs oder der Eigenschaft. Wenn das angegebene Attribut oder die Eigenschaft derzeit nicht animiert wird, enthält es den gleichen Wert wie baseVal.

Instanzmethoden

Die SVGAnimatedEnumeration-Schnittstelle bietet keine spezifischen Methoden.

Beispiele

Betrachten Sie diesen Ausschnitt mit einem <clipPath> Element: Sein clipPathUnits ist mit einem SVGAnimatedEnumeration-Objekt verknüpft.

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>

Dieser Ausschnitt ruft das Element ab und protokolliert den baseVal und animVal der SVGClipPathElement.clipPathUnits-Eigenschaft. Da keine Animation stattfindet, haben sie den gleichen Wert.

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

Spezifikationen

Specification
Scalable Vector Graphics (SVG) 2
# InterfaceSVGAnimatedEnumeration

Browser-Kompatibilität

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
SVGAnimatedEnumeration
animVal
baseVal

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support