diff --git a/files/en-us/web/api/svgradialgradientelement/fr/index.md b/files/en-us/web/api/svgradialgradientelement/fr/index.md new file mode 100644 index 000000000000000..7a238fd27e58884 --- /dev/null +++ b/files/en-us/web/api/svgradialgradientelement/fr/index.md @@ -0,0 +1,69 @@ +--- +title: "SVGRadialGradientElement: fr property" +short-title: fr +slug: Web/API/SVGRadialGradientElement/fr +page-type: web-api-instance-property +browser-compat: api.SVGRadialGradientElement.fr +--- + +{{APIRef("SVG")}} + +The **`fr`** read-only property of the {{domxref("SVGRadialGradientElement")}} interface describes the radius of the focal circle of the radial gradient as an {{domxref("SVGAnimatedLength")}}. It reflects the computed value of the {{SVGAttr("fr")}} attribute on the {{SVGElement("radialGradient")}} element. + +The attribute value is a [``](/en-US/docs/Web/SVG/Guides/Content_type#length), [``](/en-US/docs/Web/SVG/Guides/Content_type#percentage), or [``](/en-US/docs/Web/SVG/Guides/Content_type#number). The numeric value of the {{domxref("SVGAnimatedLength.baseVal")}} is the radius of the focal point of the radial gradient in the user coordinate system. + +## Value + +An {{domxref("SVGAnimatedLength")}}. + +## Example + +Given the following SVG, with two identical gradients declared with different unit types: + +```html + + + + + + + + + + + + + + + +``` + +We can access the `fr` attributes' unit type, value, and value as specified without the unit type: + +```js +const radialGradients = document.querySelectorAll("radialGradient"); +const frGradient1 = radialGradients[0].fr; +const frGradient2 = radialGradients[1].fr; + +console.log(frGradient1.baseVal.unitType); // 1 (SVGLength.SVG_LENGTHTYPE_NUMBER) +console.log(frGradient1.baseVal.value); // 0.5 +console.log(frGradient1.baseVal.valueInSpecifiedUnits); // 0.5 + +console.log(frGradient2.baseVal.unitType); // 2 (SVGLength.SVG_LENGTHTYPE_PERCENTAGE) +console.log(frGradient2.baseVal.value); // 79.05693817138672 +console.log(frGradient2.baseVal.valueInSpecifiedUnits); // 50 +``` + +## Specifications + +{{Specifications}} + +## Browser compatibility + +{{Compat}} + +## See also + +- {{domxref("SVGRadialGradientElement.fx")}} +- {{domxref("SVGLength.unitType")}} +- {{domxref("SVGAnimatedLength.baseVal")}} diff --git a/files/en-us/web/api/svgradialgradientelement/index.md b/files/en-us/web/api/svgradialgradientelement/index.md index 0b96d5a8ded9adf..fad1663d6520baa 100644 --- a/files/en-us/web/api/svgradialgradientelement/index.md +++ b/files/en-us/web/api/svgradialgradientelement/index.md @@ -21,6 +21,8 @@ _This interface also inherits properties from its parent, {{domxref("SVGGradient - : An {{domxref("SVGAnimatedLength")}} corresponding to the {{SVGAttr("cy")}} attribute of the given {{SVGElement("RadialGradient")}} element. - {{domxref("SVGRadialGradientElement.r")}} {{ReadOnlyInline}} - : An {{domxref("SVGAnimatedLength")}} corresponding to the {{SVGAttr("r")}} attribute of the given {{SVGElement("RadialGradient")}} element. +- {{domxref("SVGRadialGradientElement.fr")}} {{ReadOnlyInline}} + - : An {{domxref("SVGAnimatedLength")}} corresponding to the {{SVGAttr("fr")}} attribute. - {{domxref("SVGRadialGradientElement.fx")}} {{ReadOnlyInline}} - : An {{domxref("SVGAnimatedLength")}} corresponding to the {{SVGAttr("fx")}} attribute of the given {{SVGElement("RadialGradient")}} element. - {{domxref("SVGRadialGradientElement.fy")}} {{ReadOnlyInline}}