<feDropShadow>
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.
<feDropShadow>
は SVG のフィルタープリミティブで、入力画像のドロップシャドウを生成します。これは <filter>
要素の中でのみ使用できます。
メモ:
ドロップシャドウの色や不透明度は、 flood-color
や flood-opacity
の各プレゼンテーション属性を使用することで変更できます。
他のフィルタープリミティブと同様に、既定では色成分を linearRGB
色空間で処理します。 color-interpolation-filters
を使用すると、代わりに sRGB
を使用することができます。
例
html
<svg viewBox="0 0 30 10" xmlns="http://www.w3.org/2000/svg">
<defs>
<filter id="shadow">
<feDropShadow dx="0.2" dy="0.4" stdDeviation="0.2" />
</filter>
<filter id="shadow2">
<feDropShadow dx="0" dy="0" stdDeviation="0.5" flood-color="cyan" />
</filter>
<filter id="shadow3">
<feDropShadow
dx="-0.8"
dy="-0.8"
stdDeviation="0"
flood-color="pink"
flood-opacity="0.5" />
</filter>
</defs>
<circle cx="5" cy="50%" r="4" style="fill:pink; filter:url(#shadow);" />
<circle cx="15" cy="50%" r="4" style="fill:pink; filter:url(#shadow2);" />
<circle cx="25" cy="50%" r="4" style="fill:pink; filter:url(#shadow3);" />
</svg>
属性
使用コンテキスト
仕様書
Specification |
---|
Filter Effects Module Level 1 # feDropShadowElement |
ブラウザーの互換性
関連情報
- SVG フィルタープリミティブ属性、例えば
height
,in
,result
,x
,y
,width
など。 - SVG プレゼンテーション属性、例えば
flood-color
,flood-opacity
など。