diffuseConstant

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

Das Attribut diffuseConstant repräsentiert den kd-Wert im Phong-Beleuchtungsmodell. In SVG kann dies jede nicht-negative Zahl sein.

Es wird verwendet, um den endgültigen RGB-Wert eines bestimmten Pixels zu bestimmen. Je heller die Lichtfarbe, desto kleiner sollte dieser Wert sein.

Dieses Attribut kann mit den folgenden SVG-Elementen verwendet werden:

Beispiel

html
<svg viewBox="0 0 420 200" xmlns="http://www.w3.org/2000/svg">
  <filter id="diffuseLighting1" x="0" y="0" width="100%" height="100%">
    <feDiffuseLighting in="SourceGraphic" diffuseConstant="1">
      <fePointLight x="60" y="60" z="20" />
    </feDiffuseLighting>
  </filter>
  <filter id="diffuseLighting2" x="0" y="0" width="100%" height="100%">
    <feDiffuseLighting in="SourceGraphic" diffuseConstant="2">
      <fePointLight x="60" y="60" z="20" />
    </feDiffuseLighting>
  </filter>

  <rect
    x="0"
    y="0"
    width="200"
    height="200"
    style="filter: url(#diffuseLighting1);" />
  <rect
    x="0"
    y="0"
    width="200"
    height="200"
    style="filter: url(#diffuseLighting2); transform: translateX(220px);" />
</svg>

Hinweise zur Nutzung

Wert <number>
Standardwert 1
Animierbar Ja

Spezifikationen

Specification
Filter Effects Module Level 1
# element-attrdef-fediffuselighting-diffuseconstant

Browser-Kompatibilität

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
diffuseConstant

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support

Siehe auch