SVGGradientElement: spreadMethod Eigenschaft
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 spreadMethod
Eigenschaft der SVGGradientElement
Schnittstelle ist eine schreibgeschützte Eigenschaft, die das spreadMethod
Attribut des angegebenen Elements widerspiegelt. Sie nimmt einen der SVG_SPREADMETHOD_*
Konstanten an, die in dieser Schnittstelle definiert sind.
Wert
Beispiele
Zugriff auf die spreadMethod
Eigenschaft
html
<svg xmlns="http://www.w3.org/2000/svg" width="200" height="200">
<defs>
<linearGradient id="gradient2" spreadMethod="reflect">
<stop offset="0%" stop-color="red" />
<stop offset="50%" stop-color="yellow" />
<stop offset="100%" stop-color="blue" />
</linearGradient>
</defs>
<rect x="10" y="10" width="180" height="180" fill="url(#gradient2)" />
</svg>
js
const gradient = document.getElementById("gradient2");
console.log(gradient.spreadMethod.baseVal); // Output: 2 (SVG_SPREADMETHOD_REFLECT)
Spezifikationen
Specification |
---|
Scalable Vector Graphics (SVG) 2 # __svg__SVGGradientElement__spreadMethod |
Browser-Kompatibilität
BCD tables only load in the browser