Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Pages: SVGFEDropShadowElement #37428

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions files/en-us/web/api/svgfedropshadowelement/dx/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
---
title: "SVGFEDropShadowElement: dx property"
short-title: dx
slug: Web/API/SVGFEDropShadowElement/dx
page-type: web-api-instance-property
browser-compat: api.SVGFEDropShadowElement.dx
---

{{APIRef("SVG")}}

The **`dx`** read-only property of the {{domxref("SVGFEDropShadowElement")}} interface reflects the {{SVGAttr("dx")}} attribute of the given {{SVGElement("feDropShadow")}} element.

## Value

An {{domxref("SVGAnimatedNumber")}} object.

## Examples

### Accessing the `dx` attribute

```html
<svg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg">
<defs>
<filter id="drop-shadow-filter">
<!-- Drop Shadow with dx property set to 10 -->
<feDropShadow
in="SourceGraphic"
dx="10"
dy="10"
stdDeviation="5"
flood-color="red" />
</filter>
</defs>

<!-- Rectangle with a red shadow -->
<rect
x="20"
y="20"
width="100"
height="100"
style="fill:red;"
filter="url(#drop-shadow-filter)" />

<!-- Circle with a red shadow -->
<circle
cx="100"
cy="100"
r="50"
style="fill:blue;"
filter="url(#drop-shadow-filter)" />
</svg>
```

```js
const dropShadow = document.querySelector("feDropShadow");

console.log(dropShadow.dx.baseVal); // Output: 10
```

## Specifications

{{Specifications}}

## Browser compatibility

{{Compat}}

## See also

- {{domxref("SVGAnimatedNumber")}}
70 changes: 70 additions & 0 deletions files/en-us/web/api/svgfedropshadowelement/dy/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
---
title: "SVGFEDropShadowElement: dy property"
short-title: dy
slug: Web/API/SVGFEDropShadowElement/dy
page-type: web-api-instance-property
browser-compat: api.SVGFEDropShadowElement.dy
---

{{APIRef("SVG")}}

The **`dy`** read-only property of the {{domxref("SVGFEDropShadowElement")}} interface reflects the {{SVGAttr("dy")}} attribute of the given {{SVGElement("feDropShadow")}} element.

## Value

An {{domxref("SVGAnimatedNumber")}} object.

## Examples

### Accessing the `dy` attribute

```html
<svg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg">
<defs>
<filter id="drop-shadow-filter">
<!-- Drop Shadow with dy property set to 10 -->
<feDropShadow
in="SourceGraphic"
dx="10"
dy="10"
stdDeviation="5"
flood-color="red" />
</filter>
</defs>

<!-- Rectangle with a red shadow -->
<rect
x="20"
y="20"
width="100"
height="100"
style="fill:red;"
filter="url(#drop-shadow-filter)" />

<!-- Circle with a red shadow -->
<circle
cx="100"
cy="100"
r="50"
style="fill:blue;"
filter="url(#drop-shadow-filter)" />
</svg>
```

```js
const dropShadow = document.querySelector("feDropShadow");

console.log(dropShadow.dy.baseVal); // Output: 10
```

## Specifications

{{Specifications}}

## Browser compatibility

{{Compat}}

## See also

- {{domxref("SVGAnimatedNumber")}}
78 changes: 78 additions & 0 deletions files/en-us/web/api/svgfedropshadowelement/in1/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
---
title: "SVGFEDropShadowElement: in1 property"
short-title: in1
slug: Web/API/SVGFEDropShadowElement/in1
page-type: web-api-instance-property
browser-compat: api.SVGFEDropShadowElement.in1
---

{{APIRef("SVG")}}

The **`in1`** read-only property of the {{domxref("SVGFEDropShadowElement")}} interface reflects the {{SVGAttr("in")}} attribute of the given {{SVGElement("feDropShadow")}} element.

## Value

An {{domxref("SVGAnimatedString")}} object.

## Examples

In this example, two {{SVGElement("feDropShadow")}} elements are defined in a filter, each with a different `in` attribute.

```html
<svg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg">
<defs>
<filter id="drop-shadow-filter">
<!-- First Drop Shadow applied to the SourceGraphic -->
<feDropShadow
in="SourceGraphic"
dx="10"
dy="10"
stdDeviation="5"
flood-color="red" />
<!-- Second Drop Shadow applied to the BackgroundImage -->
<feDropShadow
in="BackgroundImage"
dx="-10"
dy="-10"
stdDeviation="5"
flood-color="blue" />
</filter>
</defs>
<!-- Rectangle with red shadow -->
<rect
x="20"
y="20"
width="100"
height="100"
style="fill:red;"
filter="url(#drop-shadow-filter)" />
<!-- Circle with blue shadow -->
<circle
cx="100"
cy="100"
r="50"
style="fill:blue;"
filter="url(#drop-shadow-filter)" />
</svg>
```

We can access the `in` attribute:

```js
const dropShadows = document.querySelectorAll("feDropShadow");

console.log(dropShadows[0].in1.baseVal); // Output: "SourceGraphic"
console.log(dropShadows[1].in1.baseVal); // Output: "BackgroundImage"
```

## Specifications

{{Specifications}}

## Browser compatibility

{{Compat}}

## See also

- {{domxref("SVGAnimatedString")}}
4 changes: 2 additions & 2 deletions files/en-us/web/api/svgfedropshadowelement/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ _This interface also inherits properties from its parent interface, {{domxref("S
- {{domxref("SVGFEDropShadowElement.result")}} {{ReadOnlyInline}}
- : An {{domxref("SVGAnimatedString")}} corresponding to the {{SVGAttr("result")}} attribute of the given element.
- {{domxref("SVGFEDropShadowElement.stdDeviationX")}} {{ReadOnlyInline}}
- : An {{domxref("SVGAnimatedNumber")}} corresponding to the (possibly automatically computed) X component of the {{SVGAttr("stdDeviationX")}} attribute of the given element.
- : An {{domxref("SVGAnimatedNumber")}} corresponding to the (possibly automatically computed) X component of the {{SVGAttr("stdDeviation")}} attribute of the given element.
- {{domxref("SVGFEDropShadowElement.stdDeviationY")}} {{ReadOnlyInline}}
- : An {{domxref("SVGAnimatedNumber")}} corresponding to the (possibly automatically computed) Y component of the {{SVGAttr("stdDeviationY")}} attribute of the given element.
- : An {{domxref("SVGAnimatedNumber")}} corresponding to the (possibly automatically computed) Y component of the {{SVGAttr("stdDeviation")}} attribute of the given element.
- {{domxref("SVGFEDropShadowElement.width")}} {{ReadOnlyInline}}
- : An {{domxref("SVGAnimatedLength")}} corresponding to the {{SVGAttr("width")}} attribute of the given element.
- {{domxref("SVGFEDropShadowElement.x")}} {{ReadOnlyInline}}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
---
title: "SVGFEDropShadowElement: setStdDeviation() method"
short-title: setStdDeviation()
slug: Web/API/SVGFEDropShadowElement/setStdDeviation
page-type: web-api-instance-method
browser-compat: api.SVGFEDropShadowElement.setStdDeviation
---

{{APIRef("SVG")}}

The `setStdDeviation()` method of the {{domxref("SVGFEDropShadowElement")}} interface sets the values for the {{SVGAttr("stdDeviation")}} attribute.

## Syntax

```js-nolint
SVGFEDropShadowElement.setStdDeviation(x, y)
```

### Parameters

- `x`
- : A float representing X component of the {{SVGAttr("stdDeviation")}} attribute.
- `y`
- : A float representing Y component of the {{SVGAttr("stdDeviation")}} attribute.

### Return value

None ({{jsxref('undefined')}}).

## Examples

### Using `setStdDeviation()`

```html
<svg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg">
<defs>
<filter id="drop-shadow-filter">
<feDropShadow
in="SourceGraphic"
dx="10"
dy="10"
stdDeviation="5 5"
flood-color="gray" />
</filter>
</defs>

<!-- Rectangle with an initial gray shadow -->
<rect
x="50"
y="50"
width="100"
height="100"
style="fill:red;"
filter="url(#drop-shadow-filter)" />
</svg>

<!-- Button to update the shadow -->
<button id="updateShadow">Update Shadow</button>
```

```js
// Get the feDropShadow element
const dropShadow = document.querySelector("feDropShadow");

// Button to trigger the update
document.getElementById("updateShadow").addEventListener("click", () => {
// Change the standard deviation (blur radius) of the shadow
dropShadow.setStdDeviation(15, 20);
});
```

## Specifications

{{Specifications}}

## Browser compatibility

{{Compat}}

## See also

- {{domxref("SVGAnimatedLength")}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
title: "SVGFEDropShadowElement: stdDeviationX property"
short-title: stdDeviationX
slug: Web/API/SVGFEDropShadowElement/stdDeviationX
page-type: web-api-instance-property
browser-compat: api.SVGFEDropShadowElement.stdDeviationX
---

{{APIRef("SVG")}}

The **`stdDeviationX`** read-only property of the {{domxref("SVGFEDropShadowElement")}} interface reflects the (possibly automatically computed) X component of the {{SVGAttr("stdDeviation")}} attribute of the given {{SVGElement("feDropShadow")}} element.

## Value

An {{domxref("SVGAnimatedNumber")}} object.

## Examples

### Accessing the `stdDeviationX` attribute

```html
<svg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg">
<defs>
<filter id="drop-shadow-filter">
<!-- Drop Shadow with stdDeviationY property set to 10 for vertical blur -->
<feDropShadow
in="SourceGraphic"
dx="10"
dy="10"
stdDeviation="5 10"
flood-color="gray" />
</filter>
</defs>

<!-- Rectangle with a gray shadow -->
<rect
x="50"
y="50"
width="100"
height="100"
style="fill:red;"
filter="url(#drop-shadow-filter)" />
</svg>
```

```js
const dropShadow = document.querySelector("feDropShadow");

console.log(dropShadow.stdDeviationX.baseVal); // Output: 5
```

## Specifications

{{Specifications}}

## Browser compatibility

{{Compat}}

## See also

- {{domxref("SVGAnimatedNumber")}}
Loading
Loading