forked from mdn/content
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New Pages: SVGFilterElement (mdn#37410)
* New Pages: SVGFilterElement * Apply suggestions from code review --------- Co-authored-by: Estelle Weyl <[email protected]>
- Loading branch information
1 parent
d864c4f
commit ed8d1fc
Showing
7 changed files
with
339 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
--- | ||
title: "SVGFilterElement: filterUnits property" | ||
short-title: filterUnits | ||
slug: Web/API/SVGFilterElement/filterUnits | ||
page-type: web-api-instance-property | ||
browser-compat: api.SVGFilterElement.filterUnits | ||
--- | ||
|
||
{{APIRef("SVG")}} | ||
|
||
The **`filterUnits`** read-only property of the {{domxref("SVGFilterElement")}} interface reflects the {{SVGAttr("filterUnits")}} attribute of the given {{SVGElement("filter")}} element. It takes one of the `SVG_UNIT_TYPE_*` constants defined in {{domxref("SVGUnitTypes")}}. | ||
|
||
## Value | ||
|
||
An {{domxref("SVGAnimatedEnumeration")}}. | ||
|
||
## Examples | ||
|
||
### Accessing the `filterUnits` property | ||
|
||
```html | ||
<svg xmlns="http://www.w3.org/2000/svg" width="400" height="200"> | ||
<defs> | ||
<filter | ||
id="myFilter" | ||
filterUnits="userSpaceOnUse" | ||
x="0" | ||
y="0" | ||
width="200%" | ||
height="200%"> | ||
<feGaussianBlur in="SourceGraphic" stdDeviation="15" result="blurred" /> | ||
</filter> | ||
</defs> | ||
<rect | ||
width="200" | ||
height="200" | ||
stroke="green" | ||
stroke-width="10" | ||
fill="lime" | ||
filter="url(#myFilter)" /> | ||
</svg> | ||
``` | ||
|
||
```js | ||
const filterElement = document.querySelector("filter"); | ||
|
||
// Access the filterUnits property | ||
console.log(filterElement.filterUnits.baseVal); // Output: 1 (SVG_UNIT_TYPE_USERSPACEONUSE) | ||
``` | ||
|
||
## Specifications | ||
|
||
{{Specifications}} | ||
|
||
## Browser compatibility | ||
|
||
{{Compat}} | ||
|
||
## See also | ||
|
||
- {{domxref("SVGFilterElement.primitiveUnits")}} | ||
- {{domxref("SVGUnitTypes")}} | ||
- [SVG filter primitive attributes](/en-US/docs/Web/SVG/Attribute#filters_attributes) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
--- | ||
title: "SVGFilterElement: height property" | ||
short-title: height | ||
slug: Web/API/SVGFilterElement/height | ||
page-type: web-api-instance-property | ||
browser-compat: api.SVGFilterElement.height | ||
--- | ||
|
||
{{APIRef("SVG")}} | ||
|
||
The **`height`** read-only property of the {{domxref("SVGFilterElement")}} interface describes the vertical size of an SVG filter primitive as a {{domxref("SVGAnimatedLength")}}. | ||
|
||
It reflects the {{SVGAttr("height")}} attribute of the {{SVGElement("filter")}} element. The attribute is a [`<length>`](/en-US/docs/Web/SVG/Content_type#length) or a [`<percentage>`](/en-US/docs/Web/SVG/Content_type#percentage) relative to the height of the filter region. The default value is `100%`. The property value is a length in user coordinate system units. | ||
|
||
## Value | ||
|
||
An {{domxref("SVGAnimatedLength")}}. | ||
|
||
## Example | ||
|
||
```js | ||
const filter = document.querySelector("filter"); | ||
const verticalSize = filter.height; | ||
console.log(verticalSize.baseVal.value); // the `height` value | ||
``` | ||
|
||
## Specifications | ||
|
||
{{Specifications}} | ||
|
||
## Browser compatibility | ||
|
||
{{Compat}} | ||
|
||
## See also | ||
|
||
- [SVG tutorial: Filter effects](/en-US/docs/Web/SVG/Tutorial/Filter_effects) | ||
- [SVG filter primitive attributes](/en-US/docs/Web/SVG/Attribute#filters_attributes) | ||
- CSS {{cssxref("blend-mode")}} data type | ||
- CSS {{cssxref("mix-blend-mode")}} property |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
--- | ||
title: "SVGFilterElement: href property" | ||
short-title: href | ||
slug: Web/API/SVGFilterElement/href | ||
page-type: web-api-instance-property | ||
browser-compat: api.SVGFilterElement.href | ||
--- | ||
|
||
{{APIRef("SVG")}} | ||
|
||
The **`href`** read-only property of the {{domxref("SVGFilterElement")}} interface reflects the {{SVGAttr("href")}} or {{SVGAttr("xlink:href")}} {{deprecated_inline}} attribute of the given {{SVGElement("filter")}} element. | ||
|
||
## Value | ||
|
||
An {{domxref("SVGAnimatedString")}}. | ||
|
||
## Examples | ||
|
||
### Accessing the `href` property | ||
|
||
```html | ||
<svg xmlns="http://www.w3.org/2000/svg" width="400" height="200"> | ||
<defs> | ||
<filter id="myFilter" x="0" y="0" width="200%" height="200%"> | ||
<feGaussianBlur in="SourceGraphic" stdDeviation="15" result="blurred" /> | ||
</filter> | ||
</defs> | ||
<rect | ||
width="200" | ||
height="200" | ||
stroke="green" | ||
stroke-width="10" | ||
fill="lime" | ||
filter="url(#myFilter)" /> | ||
</svg> | ||
``` | ||
|
||
```js | ||
const filterElement = document.querySelector("filter"); | ||
|
||
// Access the href property | ||
console.log(filterElement.href.baseVal); // Output: "#myFilter" | ||
``` | ||
|
||
## Specifications | ||
|
||
{{Specifications}} | ||
|
||
## Browser compatibility | ||
|
||
{{Compat}} | ||
|
||
## See also | ||
|
||
- SVG {{SVGAttr("href")}} attribute |
61 changes: 61 additions & 0 deletions
61
files/en-us/web/api/svgfilterelement/primitiveunits/index.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
--- | ||
title: "SVGFilterElement: primitiveUnits property" | ||
short-title: primitiveUnits | ||
slug: Web/API/SVGFilterElement/primitiveUnits | ||
page-type: web-api-instance-property | ||
browser-compat: api.SVGFilterElement.primitiveUnits | ||
--- | ||
|
||
{{APIRef("SVG")}} | ||
|
||
The **`primitiveUnits`** read-only property of the {{domxref("SVGFilterElement")}} interface reflects the {{SVGAttr("primitiveUnits")}} attribute of the given {{SVGElement("filter")}} element. It takes one of the `SVG_UNIT_TYPE_*` constants defined in {{domxref("SVGUnitTypes")}}. | ||
|
||
## Value | ||
|
||
An {{domxref("SVGAnimatedEnumeration")}} object. | ||
|
||
## Examples | ||
|
||
### Accessing the `primitiveUnits` property | ||
|
||
```html | ||
<svg xmlns="http://www.w3.org/2000/svg" width="400" height="200"> | ||
<defs> | ||
<filter | ||
id="myFilter" | ||
primitiveUnits="userSpaceOnUse" | ||
x="0" | ||
y="0" | ||
width="200%" | ||
height="200%"> | ||
<feGaussianBlur in="SourceGraphic" stdDeviation="15" result="blurred" /> | ||
</filter> | ||
</defs> | ||
<rect | ||
width="200" | ||
height="200" | ||
stroke="green" | ||
stroke-width="10" | ||
fill="lime" | ||
filter="url(#myFilter)" /> | ||
</svg> | ||
``` | ||
|
||
```js | ||
const filterElement = document.querySelector("filter"); | ||
|
||
// Access the primitiveUnits property | ||
console.log(filterElement.primitiveUnits.baseVal); // Output: 1 (SVG_UNIT_TYPE_USERSPACEONUSE) | ||
``` | ||
|
||
## Specifications | ||
|
||
{{Specifications}} | ||
|
||
## Browser compatibility | ||
|
||
{{Compat}} | ||
|
||
## See also | ||
|
||
- {{domxref("SVGFilterElement.filterUnits")}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
--- | ||
title: "SVGFilterElement: width property" | ||
short-title: width | ||
slug: Web/API/SVGFilterElement/width | ||
page-type: web-api-instance-property | ||
browser-compat: api.SVGFilterElement.width | ||
--- | ||
|
||
{{APIRef("SVG")}} | ||
|
||
The **`width`** read-only property of the {{domxref("SVGFilterElement")}} interface describes the horizontal size of an SVG filter primitive as a {{domxref("SVGAnimatedLength")}}. | ||
|
||
It reflects the {{SVGAttr("width")}} attribute of the {{SVGElement("filter")}} element. The attribute is a [`<length>`](/en-US/docs/Web/SVG/Content_type#length) or a [`<percentage>`](/en-US/docs/Web/SVG/Content_type#percentage) relative to the width of the filter region. The default value is `100%`. The property value is a length in user coordinate system units. | ||
|
||
## Value | ||
|
||
An {{domxref("SVGAnimatedLength")}}. | ||
|
||
## Example | ||
|
||
```js | ||
const filter = document.querySelector("filter"); | ||
const horizontalSize = filter.width; | ||
console.log(horizontalSize.baseVal.value); // the `width` value | ||
``` | ||
|
||
## Specifications | ||
|
||
{{Specifications}} | ||
|
||
## Browser compatibility | ||
|
||
{{Compat}} | ||
|
||
## See also | ||
|
||
- [SVG tutorial: Filter effects](/en-US/docs/Web/SVG/Tutorial/Filter_effects) | ||
- [SVG Filter primitive attributes](/en-US/docs/Web/SVG/Attribute#filters_attributes) | ||
- CSS {{cssxref("blend-mode")}} data type | ||
- CSS {{cssxref("mix-blend-mode")}} property |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
--- | ||
title: "SVGFilterElement: x property" | ||
short-title: x | ||
slug: Web/API/SVGFilterElement/x | ||
page-type: web-api-instance-property | ||
browser-compat: api.SVGFilterElement.x | ||
--- | ||
|
||
{{APIRef("SVG")}} | ||
|
||
The **`x`** read-only property of the {{domxref("SVGFilterElement")}} interface describes the horizontal coordinate of the position of an SVG filter primitive as a {{domxref("SVGAnimatedLength")}}. | ||
|
||
It reflects the {{SVGAttr("x")}} attribute of the {{SVGElement("filter")}} element. The attribute is a [`<length>`](/en-US/docs/Web/SVG/Content_type#length) or [`<percentage>`](/en-US/docs/Web/SVG/Content_type#percentage). The `<coordinate>` is a length in the user coordinate system that is the given distance from the origin of the user coordinate system along the x-axis. If the `x` attribute is a percent value, the property value is relative to the width of the filter region in user coordinate system units. The default value is `0`. | ||
|
||
## Value | ||
|
||
An {{domxref("SVGAnimatedLength")}}. | ||
|
||
## Example | ||
|
||
```js | ||
const filter = document.querySelector("filter"); | ||
const leftPosition = filter.x; | ||
console.log(leftPosition.baseVal.value); // the `x` value | ||
``` | ||
|
||
## Specifications | ||
|
||
{{Specifications}} | ||
|
||
## Browser compatibility | ||
|
||
{{Compat}} | ||
|
||
## See also | ||
|
||
- [SVG tutorial: Filter effects](/en-US/docs/Web/SVG/Tutorial/Filter_effects) | ||
- [SVG Filter primitive attributes](/en-US/docs/Web/SVG/Attribute#filters_attributes) | ||
- CSS {{cssxref("blend-mode")}} data type | ||
- CSS {{cssxref("mix-blend-mode")}} property |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
--- | ||
title: "SVGFilterElement: y property" | ||
short-title: "y" | ||
slug: Web/API/SVGFilterElement/y | ||
page-type: web-api-instance-property | ||
browser-compat: api.SVGFilterElement.y | ||
--- | ||
|
||
{{APIRef("SVG")}} | ||
|
||
The **`y`** read-only property of the {{domxref("SVGFilterElement")}} interface describes the vertical coordinate of the position of an SVG filter primitive as a {{domxref("SVGAnimatedLength")}}. | ||
|
||
It reflects the {{SVGAttr("y")}} attribute of the {{SVGElement("filter")}} element. The attribute is a [`<length>`](/en-US/docs/Web/SVG/Content_type#length) or [`<percentage>`](/en-US/docs/Web/SVG/Content_type#percentage). The `<coordinate>` is a length in the user coordinate system that is the given distance from the origin of the filter along the y-axis. If the `y` attribute is a percent value, the property value is a relative to the height of the filter region in user coordinate system units. The default value is `0`. | ||
|
||
## Value | ||
|
||
An {{domxref("SVGAnimatedLength")}}. | ||
|
||
## Example | ||
|
||
```js | ||
const filter = document.querySelector("filter"); | ||
const topPosition = filter.y; | ||
console.log(topPosition.baseVal.value); // the `y` value | ||
``` | ||
|
||
## Specifications | ||
|
||
{{Specifications}} | ||
|
||
## Browser compatibility | ||
|
||
{{Compat}} | ||
|
||
## See also | ||
|
||
- [SVG tutorial: Filter effects](/en-US/docs/Web/SVG/Tutorial/Filter_effects) | ||
- [SVG Filter primitive attributes](/en-US/docs/Web/SVG/Attribute#filters_attributes) | ||
- CSS {{cssxref("blend-mode")}} data type | ||
- CSS {{cssxref("mix-blend-mode")}} property |